Skip to content

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

Merged
bors merged 1 commit into
rust-lang:masterfrom
compiler-errors:rpitit-overcapture
Sep 16, 2024
Merged

Don't ICE when RPITIT captures more method args than trait definition#130412
bors merged 1 commit into
rust-lang:masterfrom
compiler-errors:rpitit-overcapture

Conversation

@compiler-errors

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Collaborator

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

@rustbotrustbot 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
}
} 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
Copy Markdown
ContributorAuthor

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.

@jieyouxujieyouxu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@jieyouxu

Copy link
Copy Markdown
Member

@bors r+ rollup

@bors

bors commented Sep 16, 2024

Copy link
Copy Markdown
Collaborator

📌 Commit b53f5ce has been approved by jieyouxu

It is now in the queue for this repository.

@borsbors 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.
Fixesrust-lang#129850
@jieyouxu

Copy link
Copy Markdown
Member

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

@borsbors 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
Copy Markdown
ContributorAuthor

@bors r=jieyouxu

@bors

bors commented Sep 16, 2024

Copy link
Copy Markdown
Collaborator

📌 Commit 1e9fa7e has been approved by jieyouxu

It is now in the queue for this repository.

@borsbors 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:masterSep 16, 2024
@rustbotrustbot 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.
Fixesrust-lang#129850
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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

@compiler-errors@rustbot@jieyouxu@bors@rust-log-analyzer@workingjubilee