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

Make sure type_param_predicates resolves correctly for RPITIT #132373

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

compiler-errors
Copy link
Member

After #132194, we end up lowering the item bounds for an RPITIT in an ItemCtxt whose def id is the synthetic GAT, not the opaque type from the HIR.

This means that when we're resolving a shorthand projection like T::Assoc, we call the type_param_predicates function with the item_def_id of the GAT and not the opaque. That function operates on the HIR, and is not designed to work with the Node::Synthetic that gets fed for items synthesized by the compiler...

This PR reuses the trick we use elsewhere in lowering, where we intercept whether an item comes from RPITIT lowering, and forwards the query off to the correct item.

Fixes #132372

@rustbot
Copy link
Collaborator

rustbot commented Oct 30, 2024

r? @davidtwco

rustbot has assigned @davidtwco.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Oct 30, 2024
@compiler-errors
Copy link
Member Author

Maybe one of @spastorino or @fmease could review this? Otherwise nbd.

@fmease fmease assigned fmease and unassigned davidtwco Oct 30, 2024
@fmease
Copy link
Member

fmease commented Oct 30, 2024

Thanks! @bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 30, 2024

📌 Commit d53ca63 has been approved by fmease

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 Oct 30, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 31, 2024
…iaskrgr

Rollup of 3 pull requests

Successful merges:

 - rust-lang#132368 (Remove `do_not_const_check` from `Iterator` methods)
 - rust-lang#132373 (Make sure `type_param_predicates` resolves correctly for RPITIT)
 - rust-lang#132374 (Remove dead code stemming from the old effects desugaring)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit efd5645 into rust-lang:master Oct 31, 2024
6 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Oct 31, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 31, 2024
Rollup merge of rust-lang#132373 - compiler-errors:rpitit-bound, r=fmease

Make sure `type_param_predicates` resolves correctly for RPITIT

After rust-lang#132194, we end up lowering the item bounds for an RPITIT in an `ItemCtxt` whose def id is the *synthetic GAT*, not the opaque type from the HIR.

This means that when we're resolving a shorthand projection like `T::Assoc`, we call the `type_param_predicates` function with the `item_def_id` of the *GAT* and not the opaque. That function operates on the HIR, and is not designed to work with the `Node::Synthetic` that gets fed for items synthesized by the compiler...

This PR reuses the trick we use elsewhere in lowering, where we intercept whether an item comes from RPITIT lowering, and forwards the query off to the correct item.

Fixes rust-lang#132372
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
Development

Successfully merging this pull request may close these issues.

Shorthand projections inside RPITITs fail to resolve
5 participants