Discovered in real code, then minimised largely by Claude(opus-4-6). Some further minimisation by hand, then manually re-verified that the ICE is still present.
rustc 1.97.1 (8bab26f4f 2026-07-14) (Fedora 1.97.1-1.fc44)
binary: rustc
commit-hash: 8bab26f4f68e0e26f0bb7960be334d5b520ea452
commit-date: 2026-07-14
host: x86_64-unknown-linux-gnu
release: 1.97.1
LLVM version: 22.1.8
error[E0601]: `main` function not found in crate `ice`
--> ice.rs:32:2
|
32 | }
| ^ consider adding a `main` function to `ice.rs`
error[E0119]: conflicting implementations of trait `From<MyError<_>>` for type `MyError<_>`
--> ice.rs:28:1
|
28 | impl<'a, S: Site> From<<S::Child<'a> as Child>::Error> for MyError<S::Error> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl<T> From<T> for T;
thread 'rustc' (12837) panicked at compiler/rustc_hir_analysis/src/errors/remove_or_use_generic.rs:154:85:
expect_struct: found Item { owner_id: DefId(0:9 ~ ice[83e7]::MyError), kind: Enum(MyError#0, Generics { params: [GenericParam { hir_id: HirId(DefId(0:9 ~ ice[83e7]::MyError).1), def_id: DefId(0:10 ~ ice[83e7]::MyError::P), name: Plain(P#0), span: ice.rs:20:14: 20:15 (#0), pure_wrt_drop: false, kind: Type { default: None, synthetic: false }, colon_span: None, source: Generics }], predicates: [], has_where_clause_predicates: false, where_clause_span: ice.rs:20:16: 20:16 (#0), span: ice.rs:20:13: 20:16 (#0) }, EnumDef { variants: [Variant { ident: Own#0, hir_id: HirId(DefId(0:9 ~ ice[83e7]::MyError).2), def_id: DefId(0:11 ~ ice[83e7]::MyError::Own), data: Unit(HirId(DefId(0:9 ~ ice[83e7]::MyError).3), DefId(0:12 ~ ice[83e7]::MyError::Own::{constructor#0})), disr_expr: None, span: ice.rs:21:5: 21:8 (#0) }, Variant { ident: Parent#0, hir_id: HirId(DefId(0:9 ~ ice[83e7]::MyError).4), def_id: DefId(0:13 ~ ice[83e7]::MyError::Parent), data: Tuple([FieldDef { span: ice.rs:22:12: 22:13 (#0), vis_span: ice.rs:22:12: 22:12 (#0), ident: 0#0, hir_id: HirId(DefId(0:9 ~ ice[83e7]::MyError).8), def_id: DefId(0:15 ~ ice[83e7]::MyError::Parent::0), ty: Ty { hir_id: HirId(DefId(0:9 ~ ice[83e7]::MyError).6), span: ice.rs:22:12: 22:13 (#0), kind: Path(Resolved(None, Path { span: ice.rs:22:12: 22:13 (#0), res: Def(TyParam, DefId(0:10 ~ ice[83e7]::MyError::P)), segments: [PathSegment { ident: P#0, hir_id: HirId(DefId(0:9 ~ ice[83e7]::MyError).7), res: Def(TyParam, DefId(0:10 ~ ice[83e7]::MyError::P)), args: None, infer_args: false }] })) }, safety: Safe, default: None }], HirId(DefId(0:9 ~ ice[83e7]::MyError).5), DefId(0:14 ~ ice[83e7]::MyError::Parent::{constructor#0})), disr_expr: None, span: ice.rs:22:5: 22:14 (#0) }] }), span: ice.rs:20:1: 23:2 (#0), vis_span: ice.rs:20:1: 20:1 (#0), has_delayed_lints: false, eii: false }
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: the compiler unexpectedly panicked. This is a bug
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.97.1 (8bab26f4f 2026-07-14) (Fedora 1.97.1-1.fc44) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [enforce_impl_non_lifetime_params_are_constrained] checking that `<impl at ice.rs:28:1: 28:77>`'s generics are constrained by the impl header
#1 [check_well_formed] checking that `<impl at ice.rs:28:1: 28:77>` is well-formed
#2 [check_type_wf] checking that types are well-formed
#3 [analysis] running analysis passes on crate `ice`
end of query stack
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0119, E0601.
For more information about an error, try `rustc --explain E0119`.
Code
Discovered in real code, then minimised largely by Claude(opus-4-6). Some further minimisation by hand, then manually re-verified that the ICE is still present.
Meta
rustc --version --verbose:Error output
Backtrace