Skip to content

ICE: delegation: No HirId for DefId #144594

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

reuse a as b { || { use std::ops::Add; x.add } }

original:

reuse a as b { || { use std::ops::Add; x.add } } fn main() {}

Version information

rustc 1.90.0-nightly (65b6cdb6a 2025-07-28) binary: rustc commit-hash: 65b6cdb6a6d33987b9d642a4882283c71fbe3957 commit-date: 2025-07-28 host: x86_64-unknown-linux-gnu release: 1.90.0-nightly LLVM version: 20.1.8 

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

Program output

error[E0425]: cannot find function `a` in this scope --> /tmp/icemaker_global_tempdir.GOBsuI6uLW7V/rustc_testrunner_tmpdir_reporting.68eevxTlR5Y2/mvce.rs:1:7 | 1 | reuse a as b { | ^ not found in this scope error[E0425]: cannot find value `x` in this scope --> /tmp/icemaker_global_tempdir.GOBsuI6uLW7V/rustc_testrunner_tmpdir_reporting.68eevxTlR5Y2/mvce.rs:4:9 | 4 | x.add | ^ not found in this scope error[E0658]: functions delegation is not yet fully implemented --> /tmp/icemaker_global_tempdir.GOBsuI6uLW7V/rustc_testrunner_tmpdir_reporting.68eevxTlR5Y2/mvce.rs:1:1 | 1 | / reuse a as b { 2 | | || { 3 | | use std::ops::Add; 4 | | x.add 5 | | } 6 | | } | |_^ | = 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 2025-07-28; consider upgrading it if it is out of date error[E0601]: `main` function not found in crate `mvce` --> /tmp/icemaker_global_tempdir.GOBsuI6uLW7V/rustc_testrunner_tmpdir_reporting.68eevxTlR5Y2/mvce.rs:6:2 | 6 | } | ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.GOBsuI6uLW7V/rustc_testrunner_tmpdir_reporting.68eevxTlR5Y2/mvce.rs` error: internal compiler error: /rustc-dev/65b6cdb6a6d33987b9d642a4882283c71fbe3957/compiler/rustc_middle/src/hir/mod.rs:214:32: No HirId for DefId(0:4 ~ mvce[4656]::b::{closure#0}) thread 'rustc' panicked at /rustc-dev/65b6cdb6a6d33987b9d642a4882283c71fbe3957/compiler/rustc_middle/src/hir/mod.rs:214:32: Box<dyn Any> stack backtrace: 0: 0x711dc0fddea3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hf5f52471e56b3c77 1: 0x711dc1802db7 - core::fmt::write::h84c41b9a432e75e8 2: 0x711dc0fd39b3 - std::io::Write::write_fmt::h1bed43fefa2c500a 3: 0x711dc0fddd02 - std::sys::backtrace::BacktraceLock::print::h37cadd86d3cdf2a2 4: 0x711dc0fe17a7 - std::panicking::default_hook::{{closure}}::he4900cfd4119c037 5: 0x711dc0fe130b - std::panicking::default_hook::h714d3e918eaabef3 6: 0x711dc0065bc3 - std[9de738f3b1df770f]::panicking::update_hook::<alloc[84fa6edd143b6b1]::boxed::Box<rustc_driver_impl[8b2e16b5426fe55f]::install_ice_hook::{closure#1}>>::{closure#0} 7: 0x711dc0fe1fee - std::panicking::rust_panic_with_hook::h288a274c83e34e7f 8: 0x711dc009f641 - std[9de738f3b1df770f]::panicking::begin_panic::<rustc_errors[9fa276623d937f2b]::ExplicitBug>::{closure#0} 9: 0x711dc00945d6 - std[9de738f3b1df770f]::sys::backtrace::__rust_end_short_backtrace::<std[9de738f3b1df770f]::panicking::begin_panic<rustc_errors[9fa276623d937f2b]::ExplicitBug>::{closure#0}, !> 10: 0x711dc0094467 - std[9de738f3b1df770f]::panicking::begin_panic::<rustc_errors[9fa276623d937f2b]::ExplicitBug> 11: 0x711dc00a90b1 - <rustc_errors[9fa276623d937f2b]::diagnostic::BugAbort as rustc_errors[9fa276623d937f2b]::diagnostic::EmissionGuarantee>::emit_producing_guarantee 12: 0x711dc06a97fa - rustc_middle[d2d672f435ff4af8]::util::bug::opt_span_bug_fmt::<rustc_span[848413984e4365d0]::span_encoding::Span>::{closure#0} 13: 0x711dc0689b4a - rustc_middle[d2d672f435ff4af8]::ty::context::tls::with_opt::<rustc_middle[d2d672f435ff4af8]::util::bug::opt_span_bug_fmt<rustc_span[848413984e4365d0]::span_encoding::Span>::{closure#0}, !>::{closure#0} 14: 0x711dc06899bb - rustc_middle[d2d672f435ff4af8]::ty::context::tls::with_context_opt::<rustc_middle[d2d672f435ff4af8]::ty::context::tls::with_opt<rustc_middle[d2d672f435ff4af8]::util::bug::opt_span_bug_fmt<rustc_span[848413984e4365d0]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !> 15: 0x711dbd6cde30 - rustc_middle[d2d672f435ff4af8]::util::bug::bug_fmt 16: 0x711dc1ab1d05 - rustc_query_impl[f908ec19bf25b89d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f908ec19bf25b89d]::query_impl::local_def_id_to_hir_id::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d2d672f435ff4af8]::query::erase::Erased<[u8; 8usize]>> 17: 0x711dc1ab1343 - rustc_query_system[8f3127010f038fd0]::query::plumbing::try_execute_query::<rustc_query_impl[f908ec19bf25b89d]::DynamicConfig<rustc_data_structures[3f190877304a9a41]::vec_cache::VecCache<rustc_span[848413984e4365d0]::def_id::LocalDefId, rustc_middle[d2d672f435ff4af8]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[8f3127010f038fd0]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[f908ec19bf25b89d]::plumbing::QueryCtxt, false> 18: 0x711dc1ab0e4b - rustc_query_impl[f908ec19bf25b89d]::query_impl::local_def_id_to_hir_id::get_query_non_incr::__rust_end_short_backtrace 19: 0x711dc1ed31a9 - rustc_query_impl[f908ec19bf25b89d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f908ec19bf25b89d]::query_impl::hir_owner_parent::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d2d672f435ff4af8]::query::erase::Erased<[u8; 8usize]>> 20: 0x711dc1ed201b - rustc_query_system[8f3127010f038fd0]::query::plumbing::try_execute_query::<rustc_query_impl[f908ec19bf25b89d]::DynamicConfig<rustc_data_structures[3f190877304a9a41]::vec_cache::VecCache<rustc_hir[6fa30b83404d60f9]::hir_id::OwnerId, rustc_middle[d2d672f435ff4af8]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[8f3127010f038fd0]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[f908ec19bf25b89d]::plumbing::QueryCtxt, false> 21: 0x711dc1ed1c0f - rustc_query_impl[f908ec19bf25b89d]::query_impl::hir_owner_parent::get_query_non_incr::__rust_end_short_backtrace 22: 0x711dc1ed70c2 - <rustc_middle[d2d672f435ff4af8]::lint::ShallowLintLevelMap>::lint_level_id_at_node 23: 0x711dc1ed6eef - <rustc_middle[d2d672f435ff4af8]::ty::context::TyCtxt>::lint_level_at_node 24: 0x711dc1ab21c8 - rustc_hir_analysis[f35b0b19c12bb529]::check_unused::check_unused_traits 25: 0x711dc28b9909 - rustc_query_impl[f908ec19bf25b89d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f908ec19bf25b89d]::query_impl::check_unused_traits::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d2d672f435ff4af8]::query::erase::Erased<[u8; 0usize]>> 26: 0x711dc28b94fc - rustc_query_system[8f3127010f038fd0]::query::plumbing::try_execute_query::<rustc_query_impl[f908ec19bf25b89d]::DynamicConfig<rustc_query_system[8f3127010f038fd0]::query::caches::SingleCache<rustc_middle[d2d672f435ff4af8]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[f908ec19bf25b89d]::plumbing::QueryCtxt, false> 27: 0x711dc28b9276 - rustc_query_impl[f908ec19bf25b89d]::query_impl::check_unused_traits::get_query_non_incr::__rust_end_short_backtrace 28: 0x711dc1aa8866 - rustc_hir_analysis[f35b0b19c12bb529]::check_crate 29: 0x711dc1aad106 - rustc_interface[ed6b3323245567cc]::passes::analysis 30: 0x711dc1aacdc9 - rustc_query_impl[f908ec19bf25b89d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f908ec19bf25b89d]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d2d672f435ff4af8]::query::erase::Erased<[u8; 0usize]>> 31: 0x711dc28b94fc - rustc_query_system[8f3127010f038fd0]::query::plumbing::try_execute_query::<rustc_query_impl[f908ec19bf25b89d]::DynamicConfig<rustc_query_system[8f3127010f038fd0]::query::caches::SingleCache<rustc_middle[d2d672f435ff4af8]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[f908ec19bf25b89d]::plumbing::QueryCtxt, false> 32: 0x711dc28b91d0 - rustc_query_impl[f908ec19bf25b89d]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace 33: 0x711dc2cb208b - rustc_interface[ed6b3323245567cc]::passes::create_and_enter_global_ctxt::<core[a13b22b301c6dc6d]::option::Option<rustc_interface[ed6b3323245567cc]::queries::Linker>, rustc_driver_impl[8b2e16b5426fe55f]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0} 34: 0x711dc2aab11e - rustc_interface[ed6b3323245567cc]::interface::run_compiler::<(), rustc_driver_impl[8b2e16b5426fe55f]::run_compiler::{closure#0}>::{closure#1} 35: 0x711dc29b4181 - std[9de738f3b1df770f]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[ed6b3323245567cc]::util::run_in_thread_with_globals<rustc_interface[ed6b3323245567cc]::util::run_in_thread_pool_with_globals<rustc_interface[ed6b3323245567cc]::interface::run_compiler<(), rustc_driver_impl[8b2e16b5426fe55f]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> 36: 0x711dc29b3e62 - <<std[9de738f3b1df770f]::thread::Builder>::spawn_unchecked_<rustc_interface[ed6b3323245567cc]::util::run_in_thread_with_globals<rustc_interface[ed6b3323245567cc]::util::run_in_thread_pool_with_globals<rustc_interface[ed6b3323245567cc]::interface::run_compiler<(), rustc_driver_impl[8b2e16b5426fe55f]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[a13b22b301c6dc6d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 37: 0x711dc29b9fc1 - std::sys::pal::unix::thread::Thread::new::thread_start::h8d82ba4296c67c8c 38: 0x711dbc2a57eb - <unknown> 39: 0x711dbc32918c - <unknown> 40: 0x0 - <unknown> 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.90.0-nightly (65b6cdb6a 2025-07-28) running on x86_64-unknown-linux-gnu query stack during panic: #0 [local_def_id_to_hir_id] getting HIR ID of `b::{closure#0}` #1 [hir_owner_parent] getting HIR parent of `b::{closure#0}::{use#0}` #2 [check_unused_traits] checking unused trait imports in crate #3 [analysis] running analysis passes on this crate end of query stack error: aborting due to 5 previous errors Some errors have detailed explanations: E0425, E0601, 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