-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Continue folding in query normalizer on weak aliases #112777
Conversation
if res != ty | ||
&& (res.has_type_flags(ty::TypeFlags::HAS_CT_PROJECTION) || kind == ty::Weak) | ||
{ | ||
res.try_fold_with(self)? |
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.
Whereas for the CT_PROJECTION case we didn't care about the difference between try_fold_with
and try_super_fold_with
, for the weak case, we need to call try_fold_with
or else we'll skip one layer of the alias's type.
// Similarly, `tcx.normalize_weak_ty` will only unwrap one layer of type | ||
// and we need to continue folding it to reveal the TAIT behind it. | ||
if res != ty | ||
&& (res.has_type_flags(ty::TypeFlags::HAS_CT_PROJECTION) || kind == ty::Weak) |
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.
Alternatively, we could instead modify the normalize_weak_ty
query and do the deep normalization there, instead of here.
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.
that's not what we do for the other normalize queries. Maybe we should rename them to shallow_normalize_...
edit: ah, but we don't want to do this for things other than weak type aliases... hmm...
I think #112776 is another issue that this PR might fix. |
@bors r+ |
…e, r=oli-obk Continue folding in query normalizer on weak aliases Fixes rust-lang#112752 Fixes rust-lang#112731 (same root cause, so didn't make a test for it) fixes rust-lang#112776 r? `@oli-obk`
…e, r=oli-obk Continue folding in query normalizer on weak aliases Fixes rust-lang#112752 Fixes rust-lang#112731 (same root cause, so didn't make a test for it) fixes rust-lang#112776 r? ``@oli-obk``
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#109970 ([doc] `poll_fn`: explain how to `pin` captured state safely) - rust-lang#112705 (Simplify `Span::source_callee` impl) - rust-lang#112757 (Use BorrowFlag instead of explicit isize) - rust-lang#112768 (Rewrite various resolve/diagnostics errors as translatable diagnostics) - rust-lang#112777 (Continue folding in query normalizer on weak aliases) - rust-lang#112780 (Treat TAIT equation as always ambiguous in coherence) - rust-lang#112783 (Don't ICE on bound var in `reject_fn_ptr_impls`) r? `@ghost` `@rustbot` modify labels: rollup
Fixes #112752
Fixes #112731 (same root cause, so didn't make a test for it)
fixes #112776
r? @oli-obk