Skip to content

[ICE]: region variables should not be hashed #157147

@matthiaskrgr

Description

@matthiaskrgr

Code

//@ compile-flags: -Cincremental=.
#![feature(min_generic_const_args)]
fn foo<const N: usize>() {
    foo::<{ Some::<&u8> { 0: const { &0_u8 } } }>()
}
fn main() {}

Meta

rustc --version --verbose:

rustc 1.98.0-nightly (6368fd52c 2026-05-29)
binary: rustc
commit-hash: 6368fd52cb9f230dfb156097625993e7a8891800
commit-date: 2026-05-29
host: x86_64-unknown-linux-gnu
release: 1.98.0-nightly
LLVM version: 22.1.6

Error output

<output>
Backtrace

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


thread 'rustc' (4010653) panicked at /rustc-dev/6368fd52cb9f230dfb156097625993e7a8891800/compiler/rustc_type_ir/src/region_kind.rs:249:17:
region variables should not be hashed: '?0
stack backtrace:
   0:     0x7f265ccb61f9 - <<std[9abcce4dd160f9e]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[8beea9d1dfd12329]::fmt::Display>::fmt
   1:     0x7f265d420948 - core[8beea9d1dfd12329]::fmt::write
   2:     0x7f265ccccee6 - <std[9abcce4dd160f9e]::sys::stdio::unix::Stderr as std[9abcce4dd160f9e]::io::Write>::write_fmt
   3:     0x7f265cc8c41e - std[9abcce4dd160f9e]::panicking::default_hook::{closure#0}
   4:     0x7f265cca9b33 - std[9abcce4dd160f9e]::panicking::default_hook
   5:     0x7f265baa5d31 - std[9abcce4dd160f9e]::panicking::update_hook::<alloc[d5aeb3e4a90c7020]::boxed::Box<rustc_driver_impl[d1f4abc9b9e76cce]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f265cca9e12 - std[9abcce4dd160f9e]::panicking::panic_with_hook
   7:     0x7f265cc8c4e2 - std[9abcce4dd160f9e]::panicking::panic_handler::{closure#0}
   8:     0x7f265cc831e9 - std[9abcce4dd160f9e]::sys::backtrace::__rust_end_short_backtrace::<std[9abcce4dd160f9e]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f265cc8df4d - __rustc[566260b90d3d0231]::rust_begin_unwind
  10:     0x7f26597f7fcc - core[8beea9d1dfd12329]::panicking::panic_fmt
  11:     0x7f265d858e8b - <rustc_type_ir[cd8d19cac0cc5d69]::ty_kind::TyKind<rustc_middle[f3327d24101d1f2a]::ty::context::TyCtxt> as rustc_data_structures[e3286bc412f351aa]::stable_hash::StableHash>::stable_hash::<rustc_middle[f3327d24101d1f2a]::ich::StableHashState>
  12:     0x7f265d66f823 - <rustc_query_impl[c6d714a4b0075e6d]::query_impl::type_of::make_query_vtable::{closure#2} as core[8beea9d1dfd12329]::ops::function::FnOnce<(&mut rustc_middle[f3327d24101d1f2a]::ich::StableHashState, &rustc_middle[f3327d24101d1f2a]::query::erase::ErasedData<[u8; 8usize]>)>>::call_once
  13:     0x7f265dedae02 - rustc_middle[f3327d24101d1f2a]::query::inner::query_feed::<rustc_middle[f3327d24101d1f2a]::query::caches::DefIdCache<rustc_middle[f3327d24101d1f2a]::query::erase::ErasedData<[u8; 8usize]>>>
  14:     0x7f265db84d7a - <dyn rustc_hir_analysis[7def7ba204fb628c]::hir_ty_lowering::HirTyLowerer>::lower_const_arg
  15:     0x7f265db864a2 - <dyn rustc_hir_analysis[7def7ba204fb628c]::hir_ty_lowering::HirTyLowerer>::lower_const_arg
  16:     0x7f265db86af7 - <<rustc_hir_typeck[5db34e0eb89f32e3]::fn_ctxt::FnCtxt>::instantiate_value_path::CtorGenericArgsCtxt as rustc_hir_analysis[7def7ba204fb628c]::hir_ty_lowering::GenericArgsLowerer>::provided_kind
  17:     0x7f265e38c9a7 - <rustc_hir_typeck[5db34e0eb89f32e3]::fn_ctxt::FnCtxt>::instantiate_value_path
  18:     0x7f265d71c302 - <rustc_hir_typeck[5db34e0eb89f32e3]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  19:     0x7f265d73e253 - <rustc_hir_typeck[5db34e0eb89f32e3]::fn_ctxt::FnCtxt>::check_expr_call
  20:     0x7f265d71c1e0 - <rustc_hir_typeck[5db34e0eb89f32e3]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  21:     0x7f265d6fca69 - <rustc_hir_typeck[5db34e0eb89f32e3]::fn_ctxt::FnCtxt>::check_expr_block
  22:     0x7f265d71c193 - <rustc_hir_typeck[5db34e0eb89f32e3]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  23:     0x7f265d6e7098 - rustc_hir_typeck[5db34e0eb89f32e3]::check::check_fn
  24:     0x7f265d966b6b - rustc_hir_typeck[5db34e0eb89f32e3]::typeck_with_inspect::{closure#0}
  25:     0x7f265d963ab8 - rustc_query_impl[c6d714a4b0075e6d]::query_impl::typeck_root::invoke_provider_fn::__rust_begin_short_backtrace
  26:     0x7f265d67625b - rustc_query_impl[c6d714a4b0075e6d]::execution::try_execute_query::<rustc_data_structures[e3286bc412f351aa]::vec_cache::VecCache<rustc_span[1e94126128bf4f1e]::def_id::LocalDefId, rustc_middle[f3327d24101d1f2a]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[f3327d24101d1f2a]::dep_graph::graph::DepNodeIndex>, true>
  27:     0x7f265d675584 - rustc_query_impl[c6d714a4b0075e6d]::query_impl::typeck_root::execute_query_incr::__rust_end_short_backtrace
  28:     0x7f265da64532 - <rustc_middle[f3327d24101d1f2a]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[7def7ba204fb628c]::check_crate::{closure#1}>::{closure#0}
  29:     0x7f265da63f22 - rustc_hir_analysis[7def7ba204fb628c]::check_crate
  30:     0x7f265d95eebf - rustc_interface[3274979f2c9e0562]::passes::analysis
  31:     0x7f265e643bf2 - rustc_query_impl[c6d714a4b0075e6d]::execution::try_execute_query::<rustc_middle[f3327d24101d1f2a]::query::caches::SingleCache<rustc_middle[f3327d24101d1f2a]::query::erase::ErasedData<[u8; 0usize]>>, true>
  32:     0x7f265e6435aa - rustc_query_impl[c6d714a4b0075e6d]::query_impl::analysis::execute_query_incr::__rust_end_short_backtrace
  33:     0x7f265e5df0a9 - rustc_interface[3274979f2c9e0562]::interface::run_compiler::<(), rustc_driver_impl[d1f4abc9b9e76cce]::run_compiler::{closure#0}>::{closure#1}
  34:     0x7f265e584340 - std[9abcce4dd160f9e]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[3274979f2c9e0562]::util::run_in_thread_with_globals<rustc_interface[3274979f2c9e0562]::util::run_in_thread_pool_with_globals<rustc_interface[3274979f2c9e0562]::interface::run_compiler<(), rustc_driver_impl[d1f4abc9b9e76cce]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  35:     0x7f265e584a2d - <std[9abcce4dd160f9e]::thread::lifecycle::spawn_unchecked<rustc_interface[3274979f2c9e0562]::util::run_in_thread_with_globals<rustc_interface[3274979f2c9e0562]::util::run_in_thread_pool_with_globals<rustc_interface[3274979f2c9e0562]::interface::run_compiler<(), rustc_driver_impl[d1f4abc9b9e76cce]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[8beea9d1dfd12329]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:     0x7f265e58582c - <std[9abcce4dd160f9e]::sys::thread::unix::Thread>::new::thread_start
  37:     0x7f2657a981b9 - <unknown>
  38:     0x7f2657b1d21c - <unknown>
  39:                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: please attach the file at `/home/matthias/vcs/github/CRED/rustc-ice-2026-05-30T08_05_04-4010643.txt` to your bug report

note: rustc 1.98.0-nightly (6368fd52c 2026-05-29) running on x86_64-unknown-linux-gnu

note: compiler flags: -C incremental=[REDACTED]

query stack during panic:
#0 [typeck_root] type-checking `foo`
#1 [analysis] running analysis passes on crate `code`
end of query stack
warning: 1 warning emitted

Metadata

Metadata

Assignees

Labels

A-incr-compArea: Incremental compilationC-bugCategory: This is a bug.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