Skip to content

[ICE]: unexpected generic param: GenericParam #154631

Description

@matthiaskrgr

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-impl_trait_in_bindings`#![feature(impl_trait_in_bindings)]`F-non_lifetime_binders`#![feature(non_lifetime_binders)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions