Skip to content

ICE: No HirId for DefId #133771

Closed
Closed
@matthiaskrgr

Description

@matthiaskrgr

snippet:

//@compile-flags: --crate-type=lib
#![feature(generic_arg_infer)]
pub fn foo() {
    let s: [u8; 10];
    s = [0; _];
    dbg!(s);
}

Version information

rustc 1.85.0-nightly (d49be02cf 2024-12-02)
binary: rustc
commit-hash: d49be02cf6d2e2a01264fcdef1e20c826710c0f5
commit-date: 2024-12-02
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.4

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(generic_arg_infer) --crate-type=lib

Program output

error: internal compiler error: /rustc/d49be02cf6d2e2a01264fcdef1e20c826710c0f5/compiler/rustc_middle/src/hir/mod.rs:182:32: No HirId for DefId(0:5 ~ mvce[cd1a]::foo::{constant#1})

thread 'rustc' panicked at /rustc/d49be02cf6d2e2a01264fcdef1e20c826710c0f5/compiler/rustc_middle/src/hir/mod.rs:182:32:
Box<dyn Any>
stack backtrace:
   0:     0x734b34357daa - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h118bb846b40b3af7
   1:     0x734b34a13c66 - core::fmt::write::h0b664413a249cd21
   2:     0x734b359d2d91 - std::io::Write::write_fmt::h91044b6829b973ae
   3:     0x734b34357c02 - std::sys::backtrace::BacktraceLock::print::h6b2df9b41787e785
   4:     0x734b3435a10a - std::panicking::default_hook::{{closure}}::h7482aeb499a8273d
   5:     0x734b34359f53 - std::panicking::default_hook::hdf99d9ae25812da6
   6:     0x734b334d07b8 - std[54f89b4ff1b85c84]::panicking::update_hook::<alloc[9f0ac06b652d5e76]::boxed::Box<rustc_driver_impl[f749f8d2537f8c25]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x734b3435a908 - std::panicking::rust_panic_with_hook::h87604e68748e7c6e
   8:     0x734b33505fb1 - std[54f89b4ff1b85c84]::panicking::begin_panic::<rustc_errors[91543cdef5c3a6cd]::ExplicitBug>::{closure#0}
   9:     0x734b334fae76 - std[54f89b4ff1b85c84]::sys::backtrace::__rust_end_short_backtrace::<std[54f89b4ff1b85c84]::panicking::begin_panic<rustc_errors[91543cdef5c3a6cd]::ExplicitBug>::{closure#0}, !>
  10:     0x734b334f7959 - std[54f89b4ff1b85c84]::panicking::begin_panic::<rustc_errors[91543cdef5c3a6cd]::ExplicitBug>
  11:     0x734b3350fff1 - <rustc_errors[91543cdef5c3a6cd]::diagnostic::BugAbort as rustc_errors[91543cdef5c3a6cd]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x734b33afd8e3 - rustc_middle[62e7f217d80f3273]::util::bug::opt_span_bug_fmt::<rustc_span[59605b547c40ee07]::span_encoding::Span>::{closure#0}
  13:     0x734b33ae5d8a - rustc_middle[62e7f217d80f3273]::ty::context::tls::with_opt::<rustc_middle[62e7f217d80f3273]::util::bug::opt_span_bug_fmt<rustc_span[59605b547c40ee07]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x734b33ae5c1b - rustc_middle[62e7f217d80f3273]::ty::context::tls::with_context_opt::<rustc_middle[62e7f217d80f3273]::ty::context::tls::with_opt<rustc_middle[62e7f217d80f3273]::util::bug::opt_span_bug_fmt<rustc_span[59605b547c40ee07]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x734b31d07b00 - rustc_middle[62e7f217d80f3273]::util::bug::bug_fmt
  16:     0x734b34c82197 - rustc_query_impl[cd39566cd4dca284]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[cd39566cd4dca284]::query_impl::local_def_id_to_hir_id::dynamic_query::{closure#2}::{closure#0}, rustc_middle[62e7f217d80f3273]::query::erase::Erased<[u8; 8usize]>>
  17:     0x734b34c81a36 - rustc_query_system[8fafeb9956bbd4fd]::query::plumbing::try_execute_query::<rustc_query_impl[cd39566cd4dca284]::DynamicConfig<rustc_data_structures[e65fb5d2569cb23a]::vec_cache::VecCache<rustc_span[59605b547c40ee07]::def_id::LocalDefId, rustc_middle[62e7f217d80f3273]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[8fafeb9956bbd4fd]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[cd39566cd4dca284]::plumbing::QueryCtxt, false>
  18:     0x734b34c8148f - rustc_query_impl[cd39566cd4dca284]::query_impl::local_def_id_to_hir_id::get_query_non_incr::__rust_end_short_backtrace
  19:     0x734b3587ebc9 - rustc_middle[62e7f217d80f3273]::query::plumbing::query_get_at::<rustc_data_structures[e65fb5d2569cb23a]::vec_cache::VecCache<rustc_span[59605b547c40ee07]::def_id::LocalDefId, rustc_middle[62e7f217d80f3273]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[8fafeb9956bbd4fd]::dep_graph::graph::DepNodeIndex>>
  20:     0x734b34f72d01 - <rustc_metadata[c3b2ec142e29108]::rmeta::encoder::EncodeContext>::encode_def_ids
  21:     0x734b357aa726 - <rustc_metadata[c3b2ec142e29108]::rmeta::encoder::EncodeContext>::encode_crate_root
  22:     0x734b35cb4c5a - rustc_metadata[c3b2ec142e29108]::rmeta::encoder::encode_metadata
  23:     0x734b35a4ca8a - rustc_metadata[c3b2ec142e29108]::fs::encode_and_write_metadata
  24:     0x734b35a4b7fe - <rustc_interface[4167b42c413e945c]::queries::Linker>::codegen_and_build_linker
  25:     0x734b35a7915a - rustc_interface[4167b42c413e945c]::interface::run_compiler::<core[f037553049e685e6]::result::Result<(), rustc_span[59605b547c40ee07]::ErrorGuaranteed>, rustc_driver_impl[f749f8d2537f8c25]::run_compiler::{closure#0}>::{closure#1}
  26:     0x734b358df747 - std[54f89b4ff1b85c84]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[4167b42c413e945c]::util::run_in_thread_with_globals<rustc_interface[4167b42c413e945c]::util::run_in_thread_pool_with_globals<rustc_interface[4167b42c413e945c]::interface::run_compiler<core[f037553049e685e6]::result::Result<(), rustc_span[59605b547c40ee07]::ErrorGuaranteed>, rustc_driver_impl[f749f8d2537f8c25]::run_compiler::{closure#0}>::{closure#1}, core[f037553049e685e6]::result::Result<(), rustc_span[59605b547c40ee07]::ErrorGuaranteed>>::{closure#0}, core[f037553049e685e6]::result::Result<(), rustc_span[59605b547c40ee07]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f037553049e685e6]::result::Result<(), rustc_span[59605b547c40ee07]::ErrorGuaranteed>>
  27:     0x734b358df3e2 - <<std[54f89b4ff1b85c84]::thread::Builder>::spawn_unchecked_<rustc_interface[4167b42c413e945c]::util::run_in_thread_with_globals<rustc_interface[4167b42c413e945c]::util::run_in_thread_pool_with_globals<rustc_interface[4167b42c413e945c]::interface::run_compiler<core[f037553049e685e6]::result::Result<(), rustc_span[59605b547c40ee07]::ErrorGuaranteed>, rustc_driver_impl[f749f8d2537f8c25]::run_compiler::{closure#0}>::{closure#1}, core[f037553049e685e6]::result::Result<(), rustc_span[59605b547c40ee07]::ErrorGuaranteed>>::{closure#0}, core[f037553049e685e6]::result::Result<(), rustc_span[59605b547c40ee07]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f037553049e685e6]::result::Result<(), rustc_span[59605b547c40ee07]::ErrorGuaranteed>>::{closure#1} as core[f037553049e685e6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  28:     0x734b358deb2b - std::sys::pal::unix::thread::Thread::new::thread_start::h6cdfcb35b2904981
  29:     0x734b2fc6a39d - <unknown>
  30:     0x734b2fcef49c - <unknown>
  31:                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.85.0-nightly (d49be02cf 2024-12-02) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z crate-attr=feature(generic_arg_infer) --crate-type lib -Z dump-mir-dir=dir

query stack during panic:
#0 [local_def_id_to_hir_id] getting HIR ID of `foo::{constant#1}`
end of query stack
error: aborting due to 1 previous error


@rustbot label +F-generic_arg_infer

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.F-generic_arg_inferUsing `_` as a const argument: #![feature(generic_arg_infer)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions