Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace custom wf check with well_formed constructor #177

Merged
merged 1 commit into from
Jul 1, 2024

Conversation

shua
Copy link
Contributor

@shua shua commented Jun 30, 2024

This change is mostly motivated by a comment on prove_where_clause_well_formed:

FIXME(oli-obk): figure out why is this a function and not a judgment_fn.

I originally started with converting it to a judgement_fn but found I was duplicating a lot of logic from prove_wc which already exists. So I settled on moving the logic to a WhereClause::well_formed method which creates a set of goals to prove, and then calls prove_wc on those goals.

I'm not certain this is an improvement on the current code. There is more code being run (constructing a set of goals, then checking them is more than just checking), so I wouldn't expect any performance improvement, and it sort of looks like the same code just in a different place, so it's not removing much. The only justification I have is that I wouldn't ever do the reverse of this change (remove the well_formed constructor in favour of custom well_formed check).

The intent of this change is to deduplicate some logic around where clause
well-formed checks. To that end, the existing check was removed and replaced
with a well_formed method on WhereClause, which returns a set of predicates
to be checked with a standard 'prove' call.
Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's good. I've been a bit reluctant to add "synthetic" predices if we can avoid it, but this feels like one we are going to want.

@nikomatsakis nikomatsakis merged commit 3d95004 into rust-lang:main Jul 1, 2024
3 checks passed
@shua shua deleted the wcwf branch July 1, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants