Code change:
<!-- [31mICE[0m: Rustc '-Zincremental-verify-ich=yes -Cincremental=<dir-Cdebuginfo=2' 'error: internal compiler error: Unexpected node AnonConst(AnonConst { hirid: HirId(DefId(0:3 ~ [9608]::Trait).5), defid: DefId(0:5 ~ [9608]::Trait::{constant}), body: BodyId { hirid: HirId(DefId(0:3 ~ [9608]::Trait).6) } })', 'error: internal compiler error: Unexpected node AnonConst(AnonConst { hirid: HirId(DefId(0:3 ~ [9608]::Trait).5), defid: DefId(0:5 ~ [9608]::Trait::{constant}), body: BodyId { hirid: HirId(DefId(0:3 ~ [9608]::Trait).6) } })' File: --auto-reduced (treereduce-rust): original: Version information ` Command: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongProgram output</strong</summary<p</p</details<!-- query stack: note: compiler flags: -Z incremental-verify-ich=yes -C incremental=[REDACTED] -C debuginfo=2 [diagnostichirwfcheck] performing HIR wf-checking for predicate at item [typeck] type-checking [checkmatch] match-checking [mirbuilt] building MIR for [mirconst] preparing for borrow checking [mirconstqualif] const checking [mirpromoted] promoting constants in MIR for [mirborrowck] borrow-checking [mirdropselaboratedandconstchecked] elaborating drops for [mirforctfe] caching mir of for CTFE [evaltoallocationraw] const-evaluating + checking [evaltovaltree] evaluating type-level constant [checkwellformed] checking that is well-formed [checkmodtypewf] checking that types are well-formed in top-level module [analysis] running analysis passes on this crate --<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
This seeeems to bisect to :thinking: cc
Thanks Will take a look. claim
Reduced further:
the original (none reduced) one still ices :sweat_smile:
From what I can tell, it seems to have been fixed : Looks like I'm missing something
I have now opened PR to test the below original reproducer:
Sorry for causing the issue to be closed via the PR merge without asking you first. If you still believe the ICE is not fixed please reopen it.

Related discussion:
text: | = note: the only supported types are integers, `bool` and `char` <del> error: aborting due to 4 previous errors; 1 warning emitted </del> <ins> error: associated item referring to unboxed trait object for its own trait --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:44 | LL | trait Trait<const N: Trait = bar> { |       ----- in this trait ... LL |     fn fnc<const N: Trait = u32>(&self) -> Trait { |                                            ^^^^^ | help: you might have meant to use `Self` to refer to the implementing type | LL |     fn fnc<const N: Trait = u32>(&self) -> Self { |                                            ~~~~ warning: trait objects without an explicit `dyn` are deprecated --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:21 | LL |     fn fnc<const N: Trait = u32>(&self) -> Trait { |                     ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: if this is an object-safe trait, use `dyn` | LL |     fn fnc<const N: dyn Trait = u32>(&self) -> Trait { |                     +++ error[E0038]: the trait `Trait` cannot be made into an object --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:21 | LL |     fn fnc<const N: Trait = u32>(&self) -> Trait { |                     ^^^^^ `Trait` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:8 | LL | trait Trait<const N: Trait = bar> { |       ----- this trait cannot be made into an object... ... LL |     fn fnc<const N: Trait = u32>(&self) -> Trait { |        ^^^ ...because method `fnc` has generic type parameters = help: consider moving `fnc` to another trait error[E0038]: the trait `Trait` cannot be made into an object --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:13 | LL | trait Trait<const N: Trait = bar> { |             ^^^^^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:8 | LL | trait Trait<const N: Trait = bar> { |       ----- this trait cannot be made into an object... ... LL |     fn fnc<const N: Trait = u32>(&self) -> Trait { |        ^^^ ...because method `fnc` has generic type parameters = help: consider moving `fnc` to another trait = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `(dyn Trait<{const error}> + 'static)` is forbidden as the type of a const generic parameter --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:13:21 | LL |     fn fnc<const N: Trait = u32>(&self) -> Trait { |                     ^^^^^ | = note: the only supported types are integers, `bool` and `char` error: aborting due to 14 previous errors; 5 warnings emitted </ins> <del> Some errors have detailed explanations: E0391, E0425. For more information about an error, try `rustc --explain E0391`. </del> <ins> Some errors have detailed explanations: E0038, E0391, E0403, E0423, E0425. For more information about an error, try `rustc --explain E0038`. </ins>