-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Chalkify - Tweak Clause
definition and HRTBs
#49497
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PolyDomainGoal
definitely seems like a good approach from my experience with #49435. I'll try rebasing on your branch.
goal: impl_trait, | ||
hypotheses: vec![from_env], | ||
}; | ||
Lrc::new(vec![Clause::ForAll(ty::Binder::dummy(clause))]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could still be a Clause::Implies
, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In chalk, clauses which come from the program are always fully quantified so as to account for generic parameters, e.g.:
impl<T> Foo for T {}
would lower to the following clause:
forall<T> { T: Foo }
In rustc, there is no concept of « quantified by type », only by lifetime (and quantification by lifetime is only used for higher ranked types like in for<‘a> fn(&’a i32)
).
So the binder in front of the clause is indeed not useful for the moment, but you can view it as just a placeholder until rustc binders are reworked in order to account for types.
goal: trait_pred, | ||
hypotheses: where_clauses.into_iter().map(|wc| wc.into()).collect() | ||
}; | ||
Lrc::new(vec![Clause::ForAll(ty::Binder::dummy(clause))]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also could be Clause::Implies
src/librustc_traits/lowering.rs
Outdated
Clause::Implies(program_clause) => program_clause, | ||
Clause::ForAll(program_clause) => program_clause.skip_binder(), | ||
}; | ||
// Skip the top-level binder for a less verbose output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nit, but it seems like this comment is describing the let program_clause = match ...
more so than the code below it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah definitely, I’ll fix that :)
/// is equivalent to the implication `G1..Gn => D`; we usually write | ||
/// it with the reverse implication operator `:-` to emphasize the way | ||
/// that programs are actually solved (via backchaining, which starts | ||
/// with the goal to solve and proceeds from there). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Actually @nikomatsakis’s comment from his chalkify-engine branch :p)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you want to fix tmandry's nit?
@nikomatsakis done ✅ |
@bors r+ |
📌 Commit 1074a22 has been approved by |
Chalkify - Tweak `Clause` definition and HRTBs r? @nikomatsakis
r? @nikomatsakis