Skip to content

Avoid ICE in unconstrained generic parameter suggestion for enums#157846

Merged
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
TaKO8Ki:unconstrained-param-adt-suggestion
Jun 13, 2026
Merged

Avoid ICE in unconstrained generic parameter suggestion for enums#157846
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
TaKO8Ki:unconstrained-param-adt-suggestion

Conversation

@TaKO8Ki

@TaKO8Ki TaKO8Ki commented Jun 13, 2026

Copy link
Copy Markdown
Member

Fixes #156701

remove_or_use_generic accepted structs, enums, and unions as ADT self types, but later used a local HIR lookup with expect_struct() when building the type-definition suggestion. That caused an ICE when the self type was an enum.

@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 13, 2026
@rustbot

rustbot commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

r? @mu001999

rustbot has assigned @mu001999.
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, types
  • compiler, types expanded to 73 candidates
  • Random selection from 19 candidates

@mu001999

Copy link
Copy Markdown
Member

r=me after CI green

@TaKO8Ki

TaKO8Ki commented Jun 13, 2026

Copy link
Copy Markdown
Member Author

@bors r=mu001999

@rust-bors

rust-bors Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

📌 Commit fe2b36e has been approved by mu001999

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 Jun 13, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 13, 2026
…ggestion, r=mu001999

Avoid ICE in unconstrained generic parameter suggestion for enums

Fixes rust-lang#156701

`remove_or_use_generic` accepted structs, enums, and unions as ADT self types, but later used a local HIR lookup with `expect_struct()` when building the type-definition suggestion. That caused an ICE when the self type was an enum.
rust-bors Bot pushed a commit that referenced this pull request Jun 13, 2026
Rollup of 9 pull requests

Successful merges:

 - #157653 (remove AliasTerm::def_id())
 - #157773 (Remove AnonConstKind::GCA and reject generic anon consts)
 - #157846 (Avoid ICE in unconstrained generic parameter suggestion for enums)
 - #157514 ([tiny] Use multipart suggestion for finding ident when literal was expected in attr)
 - #157740 (rustdoc: correct doctest span for trailing semicolon after item)
 - #157782 (Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`)
 - #157802 (Ensure that optimize attributes on closures are inherited by the shim.)
 - #157812 (rustc_public: implement `ty::Alias` conversion)
 - #157833 (Update wasm-component-ld to 0.5.25)
rust-bors Bot pushed a commit that referenced this pull request Jun 13, 2026
Rollup of 10 pull requests

Successful merges:

 - #157714 (Improve polymorphization of raw pointer formatting)
 - #157653 (remove AliasTerm::def_id())
 - #157773 (Remove AnonConstKind::GCA and reject generic anon consts)
 - #157846 (Avoid ICE in unconstrained generic parameter suggestion for enums)
 - #157594 (note which target a missing target_feature belongs to)
 - #157740 (rustdoc: correct doctest span for trailing semicolon after item)
 - #157782 (Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`)
 - #157802 (Ensure that optimize attributes on closures are inherited by the shim.)
 - #157812 (rustc_public: implement `ty::Alias` conversion)
 - #157833 (Update wasm-component-ld to 0.5.25)
rust-bors Bot pushed a commit that referenced this pull request Jun 13, 2026
Rollup of 10 pull requests

Successful merges:

 - #157714 (Improve polymorphization of raw pointer formatting)
 - #157653 (remove AliasTerm::def_id())
 - #157773 (Remove AnonConstKind::GCA and reject generic anon consts)
 - #157846 (Avoid ICE in unconstrained generic parameter suggestion for enums)
 - #157594 (note which target a missing target_feature belongs to)
 - #157740 (rustdoc: correct doctest span for trailing semicolon after item)
 - #157782 (Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`)
 - #157802 (Ensure that optimize attributes on closures are inherited by the shim.)
 - #157812 (rustc_public: implement `ty::Alias` conversion)
 - #157833 (Update wasm-component-ld to 0.5.25)
@rust-bors rust-bors Bot merged commit 7cf580c into rust-lang:main Jun 13, 2026
13 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 13, 2026
rust-timer added a commit that referenced this pull request Jun 13, 2026
Rollup merge of #157846 - TaKO8Ki:unconstrained-param-adt-suggestion, r=mu001999

Avoid ICE in unconstrained generic parameter suggestion for enums

Fixes #156701

`remove_or_use_generic` accepted structs, enums, and unions as ADT self types, but later used a local HIR lookup with `expect_struct()` when building the type-definition suggestion. That caused an ICE when the self type was an enum.
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]: remove_or_use_generic: expect_struct: found Item

3 participants