[ICE]: `unexpected generic param: GenericParam`
Open
Nobody has claimed this yet.
C-bug
F-impl_trait_in_bindings
F-non_lifetime_binders
I-ICE
needs-triage
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
original:
#![feature(non_lifetime_binders)]
#![feature(impl_trait_in_bindings)]
fn main() {
let i = 0;
let j: impl for<T> Clone = i;
}
Version information
rustc 1.96.0-nightly (08cd08fbe 2026-03-31)
binary: rustc
commit-hash: 08cd08fbef8c6663b052d8d9e4930d5696cbb8a7
commit-date: 2026-03-31
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.2
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
--> /tmp/icemaker_global_tempdir.qVJ0uwKvZ1dL/rustc_testrunner_tmpdir_reporting.Aj4Epcfg8Ht1/mvce.rs:1:12
|
1 | #![feature(non_lifetime_binders)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: unused variable: `j`
--> /tmp/icemaker_global_tempdir.qVJ0uwKvZ1dL/rustc_testrunner_tmpdir_reporting.Aj4Epcfg8Ht1/mvce.rs:5:9
|
5 | let j: impl for<T> Clone = i;
| ^ help: if this is intentional, prefix it with an underscore: `_j`
|
= note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
warning: 2 warnings emitted
note: no errors encountered even though delayed bugs were created
note: those delayed bugs will now be shown as internal compiler errors
error: internal compiler error: unexpected generic param: GenericParam { hir_id: HirId(DefId(0:3 ~ mvce[7019]::main).7), def_id: DefId(0:4 ~ mvce[7019]::main::T), name: Plain(T#0), span: /tmp/icemaker_global_tempdir.qVJ0uwKvZ1dL/rustc_testrunner_tmpdir_reporting.Aj4Epcfg8Ht1/mvce.rs:5:21: 5:22 (#0), pure_wrt_drop: false, kind: Type { default: None, synthetic: false }, colon_span: None, source: Binder }
--> /tmp/icemaker_global_tempdir.qVJ0uwKvZ1dL/rustc_testrunner_tmpdir_reporting.Aj4Epcfg8Ht1/mvce.rs:5:21
|
5 | let j: impl for<T> Clone = i;
| ^
|
note: delayed at /rustc-dev/08cd08fbef8c6663b052d8d9e4930d5696cbb8a7/compiler/rustc_hir_typeck/src/writeback.rs:303:22
0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, alloc::string::String>
4: <rustc_hir_typeck::writeback::WritebackCx as rustc_hir::intravisit::Visitor>::visit_generic_param.cold
5: <rustc_hir_typeck::writeback::WritebackCx as rustc_hir::intravisit::Visitor>::visit_poly_trait_ref
6: rustc_hir::intravisit::walk_unambig_ty::<rustc_hir_typeck::writeback::WritebackCx>
7: <rustc_hir_typeck::writeback::WritebackCx as rustc_hir::intravisit::Visitor>::visit_local
8: <rustc_hir_typeck::writeback::WritebackCx as rustc_hir::intravisit::Visitor>::visit_expr
9: <rustc_hir_typeck::fn_ctxt::FnCtxt>::resolve_type_vars_in_body
10: rustc_hir_typeck::typeck_with_inspect::{closure#0}
11: rustc_query_impl::query_impl::typeck_root::invoke_provider_fn::__rust_begin_short_backtrace
12: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 8]>, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
13: rustc_query_impl::query_impl::typeck_root::execute_query_non_incr::__rust_end_short_backtrace
14: <rustc_middle::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis::check_crate::{closure#1}>::{closure#0}
15: rustc_hir_analysis::check_crate
16: rustc_interface::passes::analysis
17: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
18: rustc_query_impl::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
19: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
20: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
21: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
22: <std::sys::thread::unix::Thread>::new::thread_start
23: <unknown>
24: <unknown>
--> /tmp/icemaker_global_tempdir.qVJ0uwKvZ1dL/rustc_testrunner_tmpdir_reporting.Aj4Epcfg8Ht1/mvce.rs:5:21
|
5 | let j: impl for<T> Clone = i;
| ^
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: please make sure that you have updated to the latest nightly
note: rustc 1.96.0-nightly (08cd08fbe 2026-03-31) running on x86_64-unknown-linux-gnu
query stack during panic:
end of query stack
@rustbot label +F-non_lifetime_binders +F-impl_trait_in_bindings
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the ICE with the supplied o.rs program and the nightly rustc command. Start at compiler/rustc_hir_typeck/src/writeback.rs:303, where the delayed bug is reported while visiting the generic parameter. The issue is resolved when this input no longer produces an internal compiler error and receives the intended compiler handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100