Skip to content

[ICE]: adding a def'n for node-id NodeId(35) and def kind LifetimeParam but a previous def'n exists #153499

@matthiaskrgr

Description

@matthiaskrgr

snippet:

trait Trait<'a, T, const F: fn(&CStr) -> usize> {
    fn foo<'x: 'x, A, B>(&self) {}
}

reuse Trait::foo;

Version information

rustc 1.96.0-nightly (f82485388 2026-03-06)
binary: rustc
commit-hash: f82485388963286763f8c8a9261ac227627f6a18
commit-date: 2026-03-06
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.0

Possibly related line of code:

def_kind: DefKind,
def_path_data: DefPathData,
span: Span,
) -> LocalDefId {
let parent = self.current_hir_id_owner.def_id;
assert_ne!(node_id, ast::DUMMY_NODE_ID);
assert!(
self.opt_local_def_id(node_id).is_none(),
"adding a def'n for node-id {:?} and def kind {:?} but a previous def'n exists: {:?}",
node_id,
def_kind,
self.tcx.hir_def_key(self.local_def_id(node_id)),
);

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0425]: cannot find type `CStr` in this scope
 --> /tmp/icemaker_global_tempdir.6SGfY0f9qCPf/rustc_testrunner_tmpdir_reporting.EEKipKas9tub/mvce.rs:1:33
  |
1 | trait Trait<'a, T, const F: fn(&CStr) -> usize> {
  |                                 ^^^^ not found in this scope
  |
help: consider importing this struct
  |
1 + use std::ffi::CStr;
  |

error[E0658]: functions delegation is not yet fully implemented
 --> /tmp/icemaker_global_tempdir.6SGfY0f9qCPf/rustc_testrunner_tmpdir_reporting.EEKipKas9tub/mvce.rs:5:1
  |
5 | reuse Trait::foo;
  | ^^^^^^^^^^^^^^^^^
  |
  = note: see issue #118212 <https://github.com/rust-lang/rust/issues/118212> for more information
  = help: add `#![feature(fn_delegation)]` to the crate attributes to enable
  = note: this compiler was built on 2026-03-06; consider upgrading it if it is out of date


thread 'rustc' (3547296) panicked at /rustc-dev/f82485388963286763f8c8a9261ac227627f6a18/compiler/rustc_ast_lowering/src/lib.rs:592:9:
adding a def'n for node-id NodeId(35) and def kind LifetimeParam but a previous def'n exists: DefKey { parent: Some(DefIndex(3)), disambiguated_data: DisambiguatedDefPathData { data: DesugaredAnonymousLifetime, disambiguator: 0 } }
stack backtrace:
   0:     0x7fb408f5df6b - <<std[1ac9ec7f151dc343]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[2185e438fa60127]::fmt::Display>::fmt
   1:     0x7fb409622a08 - core[2185e438fa60127]::fmt::write
   2:     0x7fb408f74f76 - <std[1ac9ec7f151dc343]::sys::stdio::unix::Stderr as std[1ac9ec7f151dc343]::io::Write>::write_fmt
   3:     0x7fb408f34058 - std[1ac9ec7f151dc343]::panicking::default_hook::{closure#0}
   4:     0x7fb408f513e3 - std[1ac9ec7f151dc343]::panicking::default_hook
   5:     0x7fb407f37e4c - std[1ac9ec7f151dc343]::panicking::update_hook::<alloc[1b3f84b8c09c25b1]::boxed::Box<rustc_driver_impl[6e789f234d303bfb]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7fb408f516c2 - std[1ac9ec7f151dc343]::panicking::panic_with_hook
   7:     0x7fb408f34118 - std[1ac9ec7f151dc343]::panicking::panic_handler::{closure#0}
   8:     0x7fb408f28669 - std[1ac9ec7f151dc343]::sys::backtrace::__rust_end_short_backtrace::<std[1ac9ec7f151dc343]::panicking::panic_handler::{closure#0}, !>
   9:     0x7fb408f35b7d - __rustc[3c4f6ba47a7fa14c]::rust_begin_unwind
  10:     0x7fb405b4543c - core[2185e438fa60127]::panicking::panic_fmt
  11:     0x7fb409e54aad - <rustc_ast_lowering[b95fdc7cdede6051]::LoweringContext>::lifetime_res_to_generic_param
  12:     0x7fb409e2a134 - <rustc_ast_lowering[b95fdc7cdede6051]::LoweringContext>::lower_lifetime_binder::{closure#0}
  13:     0x7fb40987c22f - <rustc_ast_lowering[b95fdc7cdede6051]::LoweringContext>::lower_ty
  14:     0x7fb409e21fd8 - <rustc_ast_lowering[b95fdc7cdede6051]::LoweringContext>::lower_generic_param
  15:     0x7fb407a5dfbe - <<rustc_ast_lowering[b95fdc7cdede6051]::delegation::generics::HirOrAstGenerics>::into_hir_generics::{closure#0} as core[2185e438fa60127]::ops::function::FnOnce<(&mut rustc_ast[f8ca33bbd9947925]::ast::Generics,)>>::call_once
  16:     0x7fb407a450bd - <rustc_ast_lowering[b95fdc7cdede6051]::delegation::generics::HirOrAstGenerics>::into_hir_generics
  17:     0x7fb407a400c1 - <rustc_ast_lowering[b95fdc7cdede6051]::LoweringContext>::lower_delegation
  18:     0x7fb409e35dd5 - <rustc_ast_lowering[b95fdc7cdede6051]::LoweringContext>::lower_item_kind
  19:     0x7fb409e43976 - <rustc_ast_lowering[b95fdc7cdede6051]::item::ItemLowerer>::lower_node
  20:     0x7fb409e42327 - rustc_ast_lowering[b95fdc7cdede6051]::lower_to_hir
  21:     0x7fb40a884a28 - rustc_query_impl[234cac1489f93c02]::query_impl::hir_crate::invoke_provider_fn::__rust_begin_short_backtrace
  22:     0x7fb40a883944 - rustc_query_impl[234cac1489f93c02]::execution::try_execute_query::<rustc_middle[6c1cd5853b8c3360]::query::caches::SingleCache<rustc_middle[6c1cd5853b8c3360]::query::erase::ErasedData<[u8; 8usize]>>, false>
  23:     0x7fb40a8833cf - rustc_query_impl[234cac1489f93c02]::query_impl::hir_crate::execute_query_non_incr::__rust_end_short_backtrace
  24:     0x7fb4096c0c83 - rustc_query_impl[234cac1489f93c02]::query_impl::opt_hir_owner_nodes::invoke_provider_fn::__rust_begin_short_backtrace
  25:     0x7fb4096bfe4a - rustc_query_impl[234cac1489f93c02]::execution::try_execute_query::<rustc_data_structures[b1d728af8bd319df]::vec_cache::VecCache<rustc_span[bde3ed91d4975fd3]::def_id::LocalDefId, rustc_middle[6c1cd5853b8c3360]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[6c1cd5853b8c3360]::dep_graph::graph::DepNodeIndex>, false>
  26:     0x7fb4096bfac5 - rustc_query_impl[234cac1489f93c02]::query_impl::opt_hir_owner_nodes::execute_query_non_incr::__rust_end_short_backtrace
  27:     0x7fb409f6fda6 - <rustc_middle[6c1cd5853b8c3360]::ty::context::TyCtxt>::hir_owner_node
  28:     0x7fb40a88a1d1 - rustc_middle[6c1cd5853b8c3360]::hir::map::hir_crate_items
  29:     0x7fb40a88589d - rustc_query_impl[234cac1489f93c02]::query_impl::hir_crate_items::invoke_provider_fn::__rust_begin_short_backtrace
  30:     0x7fb40a883944 - rustc_query_impl[234cac1489f93c02]::execution::try_execute_query::<rustc_middle[6c1cd5853b8c3360]::query::caches::SingleCache<rustc_middle[6c1cd5853b8c3360]::query::erase::ErasedData<[u8; 8usize]>>, false>
  31:     0x7fb40a88430b - rustc_query_impl[234cac1489f93c02]::query_impl::hir_crate_items::execute_query_non_incr::__rust_end_short_backtrace
  32:     0x7fb4096bc6e2 - rustc_interface[c926bcc183cff181]::passes::analysis
  33:     0x7fb40a882760 - rustc_query_impl[234cac1489f93c02]::execution::try_execute_query::<rustc_middle[6c1cd5853b8c3360]::query::caches::SingleCache<rustc_middle[6c1cd5853b8c3360]::query::erase::ErasedData<[u8; 0usize]>>, false>
  34:     0x7fb40a882447 - rustc_query_impl[234cac1489f93c02]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
  35:     0x7fb40a83da6d - rustc_interface[c926bcc183cff181]::interface::run_compiler::<(), rustc_driver_impl[6e789f234d303bfb]::run_compiler::{closure#0}>::{closure#1}
  36:     0x7fb40a86613e - std[1ac9ec7f151dc343]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[c926bcc183cff181]::util::run_in_thread_with_globals<rustc_interface[c926bcc183cff181]::util::run_in_thread_pool_with_globals<rustc_interface[c926bcc183cff181]::interface::run_compiler<(), rustc_driver_impl[6e789f234d303bfb]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  37:     0x7fb40a8669e0 - <std[1ac9ec7f151dc343]::thread::lifecycle::spawn_unchecked<rustc_interface[c926bcc183cff181]::util::run_in_thread_with_globals<rustc_interface[c926bcc183cff181]::util::run_in_thread_pool_with_globals<rustc_interface[c926bcc183cff181]::interface::run_compiler<(), rustc_driver_impl[6e789f234d303bfb]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[2185e438fa60127]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  38:     0x7fb40a86786c - <std[1ac9ec7f151dc343]::sys::thread::unix::Thread>::new::thread_start
  39:     0x7fb4042a598b - <unknown>
  40:     0x7fb404329a0c - <unknown>
  41:                0x0 - <unknown>

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: please make sure that you have updated to the latest nightly

note: rustc 1.96.0-nightly (f82485388 2026-03-06) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [hir_crate] getting the crate HIR
#1 [opt_hir_owner_nodes] getting HIR owner items in ``
#2 [hir_crate_items] getting HIR crate items
#3 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 2 previous errors

Some errors have detailed explanations: E0425, E0658.
For more information about an error, try `rustc --explain E0425`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-fn_delegation`#![feature(fn_delegation)]`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