Skip to content

[ICE]: node_type: no type for node HirId #157772

@matthiaskrgr

Description

@matthiaskrgr

snippet:

#![feature(min_generic_const_args, adt_const_params)]
fn takes_tuple<const N: ()>() {}
fn generic_caller<T, const N: u32>() {
    takes_tuple::<{ (N, T::ASSOC) }>;
}
fn main() {}

Version information

rustc 1.98.0-nightly (32cfe5300 2026-06-11)
binary: rustc
commit-hash: 32cfe53009803b85afd40ff72768bb058e9936f0
commit-date: 2026-06-11
host: x86_64-unknown-linux-gnu
release: 1.98.0-nightly
LLVM version: 22.1.6

Possibly related line of code:

pub fn node_types_mut(&mut self) -> LocalTableInContextMut<'_, Ty<'tcx>> {
LocalTableInContextMut { hir_owner: self.hir_owner, data: &mut self.node_types }
}
pub fn node_type(&self, id: HirId) -> Ty<'tcx> {
self.node_type_opt(id).unwrap_or_else(|| {
bug!("node_type: no type for node {}", tls::with(|tcx| tcx.hir_id_to_string(id)))
})
}
pub fn node_type_opt(&self, id: HirId) -> Option<Ty<'tcx>> {
validate_hir_id_for_typeck_results(self.hir_owner, id);
self.node_types.get(&id.local_id).cloned()

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

Program output

warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.A7Kl5LjKFMUq/rustc_testrunner_tmpdir_reporting.ubah95DXJAWO/mvce.rs:1:12
  |
1 | #![feature(min_generic_const_args, adt_const_params)]
  |            ^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information
  = note: `#[warn(incomplete_features)]` on by default

warning: function `takes_tuple` is never used
 --> /tmp/icemaker_global_tempdir.A7Kl5LjKFMUq/rustc_testrunner_tmpdir_reporting.ubah95DXJAWO/mvce.rs:2:4
  |
2 | fn takes_tuple<const N: ()>() {}
  |    ^^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: function `generic_caller` is never used
 --> /tmp/icemaker_global_tempdir.A7Kl5LjKFMUq/rustc_testrunner_tmpdir_reporting.ubah95DXJAWO/mvce.rs:3:4
  |
3 | fn generic_caller<T, const N: u32>() {
  |    ^^^^^^^^^^^^^^

warning: path statement with no effect
 --> /tmp/icemaker_global_tempdir.A7Kl5LjKFMUq/rustc_testrunner_tmpdir_reporting.ubah95DXJAWO/mvce.rs:4:5
  |
4 |     takes_tuple::<{ (N, T::ASSOC) }>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(path_statements)]` (part of `#[warn(unused)]`) on by default

error: internal compiler error: /rustc-dev/32cfe53009803b85afd40ff72768bb058e9936f0/compiler/rustc_middle/src/ty/typeck_results.rs:326:13: node_type: no type for node HirId(DefId(0:5 ~ mvce[31bd]::generic_caller).6) (type `T`)


thread 'rustc' (1876225) panicked at /rustc-dev/32cfe53009803b85afd40ff72768bb058e9936f0/compiler/rustc_middle/src/ty/typeck_results.rs:326:13:
Box<dyn Any>
stack backtrace:
   0:     0x7fb4520af059 - <<std[382ac9de64b4c0b0]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[9039a521d8c1c2bb]::fmt::Display>::fmt
   1:     0x7fb4528123c8 - core[9039a521d8c1c2bb]::fmt::write
   2:     0x7fb4520c5296 - <std[382ac9de64b4c0b0]::sys::stdio::unix::Stderr as std[382ac9de64b4c0b0]::io::Write>::write_fmt
   3:     0x7fb45208499e - std[382ac9de64b4c0b0]::panicking::default_hook::{closure#0}
   4:     0x7fb4520a2163 - std[382ac9de64b4c0b0]::panicking::default_hook
   5:     0x7fb450e9100c - std[382ac9de64b4c0b0]::panicking::update_hook::<alloc[3aa65f2603192fd9]::boxed::Box<rustc_driver_impl[e5f999e2d7cbabfb]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7fb4520a2442 - std[382ac9de64b4c0b0]::panicking::panic_with_hook
   7:     0x7fb450ebecb1 - std[382ac9de64b4c0b0]::panicking::begin_panic::<rustc_errors[a446b4dd8ad3312b]::ExplicitBug>::{closure#0}
   8:     0x7fb450eb7a26 - std[382ac9de64b4c0b0]::sys::backtrace::__rust_end_short_backtrace::<std[382ac9de64b4c0b0]::panicking::begin_panic<rustc_errors[a446b4dd8ad3312b]::ExplicitBug>::{closure#0}, !>
   9:     0x7fb450eb59b7 - std[382ac9de64b4c0b0]::panicking::begin_panic::<rustc_errors[a446b4dd8ad3312b]::ExplicitBug>
  10:     0x7fb450ec9dd1 - <rustc_errors[a446b4dd8ad3312b]::diagnostic::BugAbort as rustc_errors[a446b4dd8ad3312b]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7fb45155e929 - rustc_middle[3ac6511544569964]::util::bug::opt_span_bug_fmt::<rustc_span[3b5583ae3f4ed0d2]::span_encoding::Span>::{closure#0}
  12:     0x7fb45155ea92 - rustc_middle[3ac6511544569964]::ty::context::tls::with_opt::<rustc_middle[3ac6511544569964]::util::bug::opt_span_bug_fmt<rustc_span[3b5583ae3f4ed0d2]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  13:     0x7fb45154ce8b - rustc_middle[3ac6511544569964]::ty::context::tls::with_context_opt::<rustc_middle[3ac6511544569964]::ty::context::tls::with_opt<rustc_middle[3ac6511544569964]::util::bug::opt_span_bug_fmt<rustc_span[3b5583ae3f4ed0d2]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  14:     0x7fb44f501194 - rustc_middle[3ac6511544569964]::util::bug::bug_fmt
  15:     0x7fb4529810cc - <rustc_privacy[a44f0705ad6cae56]::TypePrivacyVisitor as rustc_hir[11d7bb6f78e09090]::intravisit::Visitor>::visit_ty
  16:     0x7fb45297fe12 - <rustc_privacy[a44f0705ad6cae56]::TypePrivacyVisitor as rustc_hir[11d7bb6f78e09090]::intravisit::Visitor>::visit_qpath
  17:     0x7fb4541ec6ba - rustc_hir[11d7bb6f78e09090]::intravisit::walk_const_arg::<rustc_privacy[a44f0705ad6cae56]::TypePrivacyVisitor>.cold
  18:     0x7fb4529801d7 - rustc_hir[11d7bb6f78e09090]::intravisit::walk_generic_args::<rustc_privacy[a44f0705ad6cae56]::TypePrivacyVisitor>
  19:     0x7fb4529926a1 - <rustc_privacy[a44f0705ad6cae56]::TypePrivacyVisitor as rustc_hir[11d7bb6f78e09090]::intravisit::Visitor>::visit_expr
  20:     0x7fb452991ba2 - <rustc_privacy[a44f0705ad6cae56]::TypePrivacyVisitor as rustc_hir[11d7bb6f78e09090]::intravisit::Visitor>::visit_expr
  21:     0x7fb44ed8bd08 - rustc_privacy[a44f0705ad6cae56]::check_mod_privacy
  22:     0x7fb453691484 - rustc_query_impl[3b0e1056a574ad92]::execution::try_execute_query::<rustc_middle[3ac6511544569964]::query::caches::DefaultCache<rustc_span[3b5583ae3f4ed0d2]::def_id::LocalModDefId, rustc_middle[3ac6511544569964]::query::erase::ErasedData<[u8; 0usize]>>, false>
  23:     0x7fb45369120e - rustc_query_impl[3b0e1056a574ad92]::query_impl::check_mod_privacy::execute_query_non_incr::__rust_end_short_backtrace
  24:     0x7fb453690c88 - rustc_interface[34f0566eb39212d1]::passes::analysis::{closure#0}::{closure#1}
  25:     0x7fb45368d0e2 - rustc_data_structures[8c18856fa5480a8b]::sync::parallel::par_fns
  26:     0x7fb452ceaa83 - rustc_interface[34f0566eb39212d1]::passes::analysis
  27:     0x7fb453a0e646 - rustc_query_impl[3b0e1056a574ad92]::execution::try_execute_query::<rustc_middle[3ac6511544569964]::query::caches::SingleCache<rustc_middle[3ac6511544569964]::query::erase::ErasedData<[u8; 0usize]>>, false>
  28:     0x7fb453a0e329 - rustc_query_impl[3b0e1056a574ad92]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
  29:     0x7fb453a5fc57 - rustc_interface[34f0566eb39212d1]::interface::run_compiler::<(), rustc_driver_impl[e5f999e2d7cbabfb]::run_compiler::{closure#0}>::{closure#1}
  30:     0x7fb453a22a7a - std[382ac9de64b4c0b0]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[34f0566eb39212d1]::util::run_in_thread_with_globals<rustc_interface[34f0566eb39212d1]::util::run_in_thread_pool_with_globals<rustc_interface[34f0566eb39212d1]::interface::run_compiler<(), rustc_driver_impl[e5f999e2d7cbabfb]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  31:     0x7fb453a2282d - <std[382ac9de64b4c0b0]::thread::lifecycle::spawn_unchecked<rustc_interface[34f0566eb39212d1]::util::run_in_thread_with_globals<rustc_interface[34f0566eb39212d1]::util::run_in_thread_pool_with_globals<rustc_interface[34f0566eb39212d1]::interface::run_compiler<(), rustc_driver_impl[e5f999e2d7cbabfb]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[9039a521d8c1c2bb]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  32:     0x7fb453a18e90 - <std[382ac9de64b4c0b0]::sys::thread::unix::Thread>::new::thread_start
  33:     0x7fb44ce981b9 - <unknown>
  34:     0x7fb44cf1d21c - <unknown>
  35:                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.98.0-nightly (32cfe5300 2026-06-11) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_mod_privacy] checking privacy in top-level module
#1 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 1 previous error; 4 warnings emitted


@rustbot label +F-min_generic_const_args +F-adt_const_params

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-adt_const_params`#![feature(adt_const_params)]`F-min_generic_const_args`#![feature(min_generic_const_args)]`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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions