Skip to content

diagnostics: fix ICE in closure signature mismatch#152339

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
JonatanLindh:fix-issue-152331
Feb 8, 2026
Merged

diagnostics: fix ICE in closure signature mismatch#152339
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
JonatanLindh:fix-issue-152331

Conversation

@JonatanLindh
Copy link
Contributor

@JonatanLindh JonatanLindh commented Feb 8, 2026

Fixes #152331

Fixes an ICE where AdjustSignatureBorrow caused a panic because it attempted to set the len argument which was already defined by the parent diagnostic.

Both variants used len as argument name, but can both be present in a diagnostic. They now use different names for the argument.

@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 Feb 8, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 8, 2026

r? @BoxyUwU

rustbot has assigned @BoxyUwU.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 21 candidates
  • Random selection from 12 candidates

@rustbot

This comment has been minimized.

This fixes the ICE by renaming conflicting arguments in the diagnostic.
@Urgau
Copy link
Member

Urgau commented Feb 8, 2026

The conflicting len argument comes from the same diagnostic who is emitted twice, but not with the same suggestion.

if !to_borrow.is_empty() {
err.subdiagnostic(errors::AdjustSignatureBorrow::Borrow { to_borrow });
}
if !remove_borrow.is_empty() {
err.subdiagnostic(errors::AdjustSignatureBorrow::RemoveBorrow { remove_borrow });
}

Copy link
Member

@Urgau Urgau left a comment

Choose a reason for hiding this comment

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

Thanks, the fix makes sense to me.

View changes since this review

@Urgau
Copy link
Member

Urgau commented Feb 8, 2026

r? Urgau
@bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 8, 2026

📌 Commit fb55b5d has been approved by Urgau

It is now in the queue for this repository.

@rust-bors rust-bors bot 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 Feb 8, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 8, 2026
…rgau

diagnostics: fix ICE in closure signature mismatch

Fixes rust-lang#152331

Fixes an ICE where `AdjustSignatureBorrow` caused a panic because it attempted to set the `len` argument which was already defined by the parent diagnostic.

Both variants used `len` as  argument name, but can both be present in a diagnostic. They now use different names for the argument.
rust-bors bot pushed a commit that referenced this pull request Feb 8, 2026
…uwer

Rollup of 2 pull requests

Successful merges:

 - #152339 (diagnostics: fix ICE in closure signature mismatch)
 - #152341 (`cfg_select!`: allow optional comma after `{ /* ... */ }`)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 8, 2026
…rgau

diagnostics: fix ICE in closure signature mismatch

Fixes rust-lang#152331

Fixes an ICE where `AdjustSignatureBorrow` caused a panic because it attempted to set the `len` argument which was already defined by the parent diagnostic.

Both variants used `len` as  argument name, but can both be present in a diagnostic. They now use different names for the argument.
rust-bors bot pushed a commit that referenced this pull request Feb 8, 2026
…uwer

Rollup of 2 pull requests

Successful merges:

 - #152339 (diagnostics: fix ICE in closure signature mismatch)
 - #152341 (`cfg_select!`: allow optional comma after `{ /* ... */ }`)
rust-bors bot pushed a commit that referenced this pull request Feb 8, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #151455 (Fix `SourceFile::normalized_byte_pos`)
 - #152250 (Remove support for slugs in diagnostic messages)
 - #152322 (Replace some `feature(core_intrinsics)` with stable hints)
 - #151640 (Cleanup offload datatransfer)
 - #152212 (Port some attributes to the attr parser)
 - #152309 (Fix bound var resolution for trait aliases)
 - #152339 (diagnostics: fix ICE in closure signature mismatch)
 - #152341 (`cfg_select!`: allow optional comma after `{ /* ... */ }`)
rust-bors bot pushed a commit that referenced this pull request Feb 8, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #151455 (Fix `SourceFile::normalized_byte_pos`)
 - #152250 (Remove support for slugs in diagnostic messages)
 - #152322 (Replace some `feature(core_intrinsics)` with stable hints)
 - #152328 (Fix a few diagnostics)
 - #151640 (Cleanup offload datatransfer)
 - #152212 (Port some attributes to the attr parser)
 - #152309 (Fix bound var resolution for trait aliases)
 - #152339 (diagnostics: fix ICE in closure signature mismatch)
 - #152341 (`cfg_select!`: allow optional comma after `{ /* ... */ }`)
@rust-bors rust-bors bot merged commit e01abd7 into rust-lang:main Feb 8, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 8, 2026
rust-timer added a commit that referenced this pull request Feb 8, 2026
Rollup merge of #152339 - JonatanLindh:fix-issue-152331, r=Urgau

diagnostics: fix ICE in closure signature mismatch

Fixes #152331

Fixes an ICE where `AdjustSignatureBorrow` caused a panic because it attempted to set the `len` argument which was already defined by the parent diagnostic.

Both variants used `len` as  argument name, but can both be present in a diagnostic. They now use different names for the argument.
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]: arg len already exists

4 participants