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

Continue folding in query normalizer on weak aliases #112777

Merged
merged 1 commit into from
Jun 19, 2023

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Jun 18, 2023

Fixes #112752
Fixes #112731 (same root cause, so didn't make a test for it)
fixes #112776

r? @oli-obk

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 18, 2023
if res != ty
&& (res.has_type_flags(ty::TypeFlags::HAS_CT_PROJECTION) || kind == ty::Weak)
{
res.try_fold_with(self)?
Copy link
Member Author

@compiler-errors compiler-errors Jun 18, 2023

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)
Copy link
Member Author

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.

Copy link
Contributor

@oli-obk oli-obk Jun 19, 2023

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...

@jieyouxu
Copy link
Member

jieyouxu commented Jun 19, 2023

I think #112776 is another issue that this PR might fix.

@oli-obk
Copy link
Contributor

oli-obk commented Jun 19, 2023

@bors r+

@bors
Copy link
Contributor

bors commented Jun 19, 2023

📌 Commit 493b18b has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 19, 2023
jyn514 added a commit to jyn514/rust that referenced this pull request Jun 19, 2023
…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`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 19, 2023
…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``
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 19, 2023
…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
@bors bors merged commit 68f2f1e into rust-lang:master Jun 19, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jun 19, 2023
@compiler-errors compiler-errors deleted the normalize-weak-more branch August 11, 2023 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
5 participants