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

Don't ICE when RPITIT captures more method args than trait definition #130412

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

compiler-errors
Copy link
Member

Make sure we don't ICE when an RPITIT captures more method args than the trait definition, which is not allowed. This was because we were using the wrong def id for error reporting.

Due to the default lifetime capture rules of RPITITs (capturing everything in scope), this is only doable if we use precise capturing, which isn't currently allowed for RPITITs anyways but we still end up reaching the relevant codepaths.

Fixes #129850

@rustbot
Copy link
Collaborator

rustbot commented Sep 15, 2024

r? @jieyouxu

rustbot has assigned @jieyouxu.
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 Sep 15, 2024
@@ -899,7 +904,7 @@ impl<'tcx> ty::FallibleTypeFolder<TyCtxt<'tcx>> for RemapHiddenTyRegions<'tcx> {
);
}
} else {
let guar = match region.opt_param_def_id(self.tcx, self.tcx.parent(self.def_id)) {
let guar = match region.opt_param_def_id(self.tcx, self.impl_m_def_id) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This used the def id of the trait, rather than the def id of the impl method. The def id of the impl method is needed here because we're remapping args from the impl method's signature.

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jieyouxu
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 16, 2024

📌 Commit b53f5ce has been approved by jieyouxu

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 Sep 16, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 16, 2024
…, r=jieyouxu

Don't ICE when RPITIT captures more method args than trait definition

Make sure we don't ICE when an RPITIT captures more method args than the trait definition, which is not allowed. This was because we were using the wrong def id for error reporting.

Due to the default lifetime capture rules of RPITITs (capturing everything in scope), this is only doable if we use precise capturing, which isn't currently allowed for RPITITs anyways but we still end up reaching the relevant codepaths.

Fixes rust-lang#129850
@jieyouxu
Copy link
Member

@bors r- (need to remove the crashes test for #129850)

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 16, 2024
@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member Author

@bors r=jieyouxu

@bors
Copy link
Contributor

bors commented Sep 16, 2024

📌 Commit 1e9fa7e has been approved by jieyouxu

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 16, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 16, 2024
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#123436 (linker: Allow MSVC to use import libraries following the Meson/MinGW convention)
 - rust-lang#130410 (Don't ICE when generating `Fn` shim for async closure with borrowck error)
 - rust-lang#130412 (Don't ICE when RPITIT captures more method args than trait definition)
 - rust-lang#130436 (Ignore reduce-fadd-unordered on SGX platform)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4e68d06 into rust-lang:master Sep 16, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 16, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 16, 2024
Rollup merge of rust-lang#130412 - compiler-errors:rpitit-overcapture, r=jieyouxu

Don't ICE when RPITIT captures more method args than trait definition

Make sure we don't ICE when an RPITIT captures more method args than the trait definition, which is not allowed. This was because we were using the wrong def id for error reporting.

Due to the default lifetime capture rules of RPITITs (capturing everything in scope), this is only doable if we use precise capturing, which isn't currently allowed for RPITITs anyways but we still end up reaching the relevant codepaths.

Fixes rust-lang#129850
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.

ICE: expected lifetime parameter, but found another generic parameter
6 participants