-
Notifications
You must be signed in to change notification settings - Fork 13.5k
trait_sel: sizedness goals prefer alias candidates #144064
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
base: master
Are you sure you want to change the base?
trait_sel: sizedness goals prefer alias candidates #144064
Conversation
This comment has been minimized.
This comment has been minimized.
For sizedness, default and auto trait predicates, now prefer non-param candidates if any exist. As these traits do not have generic parameters, it never makes sense to prefer an non-alias candidate, as there can never be a more permissive candidate.
No longer require that we prove that the predicates of aliases hold when checking the well-formedness of the alias. This permits more uses of GATs and changes the output of yet more tests.
wrt 6aa3732 it's not that we stop to normalize the predicates of projections, it's that when comfirming alias-bound/ wrt
Did you already crater run this behavior? |
let is_sizedness_or_auto_or_default_predicate = self.tcx().is_sizedness_trait(did) | ||
|| self.tcx().trait_is_auto(did) | ||
|| self.tcx().is_default_trait(did); |
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.
I dislike this as is 🤔 maybe have a shared used by both old and new solver (with comments)
enum CandidatePreferenceMode {
Default,
Marker,
}
impl CandidatePreferenceMode {
fn compute<I: Interner>(cx: I, trait_def_id: I::DefId) -> CandidatePreferenceMode;
}
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.
Fixed this, introduced a CandidatePreferenceMode
and used it in both solvers
We did a crater run in #142712 (comment), which had all of these changes and included implying |
6aa3732
to
e412062
Compare
Updated the README and corrected the descriptions of everything per your comment |
Fixes #143992
MetaSized
always holds temporarily #144016 so thatMetaSized
bounds are checked properly, and updates all the tests accordingly, including makingtests/ui/sized-hierarchy/incomplete-inference-issue-143992.rs
fail when it shouldn'ttests/ui/sized-hierarchy/incomplete-inference-issue-143992.rs
passes again, buttests/ui/generic-associated-types/issue-93262.rs
starts failing when it shouldn'ttests/ui/generic-associated-types/issue-93262.rs
passes againEach commit updates all the tests to their new output so it should be easy enough to see what the impact of each change individually is. After all of the changes, tests that pass when they didn't before or vice versa:
tests/ui/extern/extern-types-size_of_val.rs
MetaSized
always holds temporarily #144016, now correctly errorstests/ui/sized-hierarchy/incomplete-inference-issue-143992.rs
MetaSized
always holds temporarily #144016 only applied to the old solver, passing now with 90e61dbtests/ui/sized-hierarchy/overflow.rs
MetaSized
always holds temporarily #144016, now correctly errorstests/ui/generic-associated-types/issue-92096.rs
C::Connecting<'placeholder>: Send
which is required when proving that the generator isSend
. This is an instance of Tracking issue for incorrect lifetime bound errors in async #110338.tests/ui/higher-ranked/trait-bounds/normalize-under-binder/norm-before-method-resolution-opaque-type.rs
This had a crater run in #142712 (comment) alongside some other changes.
r? @lcnr
cc #142712 (this extracts part of that change)