Skip to content

ICE DefId does not have a "const_of_item" #148731

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

//@compile-flags: -Zincremental-verify-ich=yes -Cincremental=<dir> -Cdebuginfo=2 -Clink-dead-code=true -Zvalidate-mir -Zquery-dep-graph -Zthreads=4 --edition=2024 #![feature(min_generic_const_args)] pub trait Foo {} impl Foo for [u8; std::path::MAIN_SEPARATOR] {}

original:

// regression test for #133808. #![allow(dead_code)] #![feature(min_generic_const_args)] #![allow(incomplete_features)] #![crate_type = "lib"] pub trait Foo {} impl Foo for [u8; std::path::MAIN_SEPARATOR] {} //~^ ERROR the constant `MAIN_SEPARATOR` is not of type `usize`

Version information

rustc 1.93.0-nightly (acda5e9f9 2025-11-09) binary: rustc commit-hash: acda5e9f9aadac705b851935b14aa3d34a67d428 commit-date: 2025-11-09 host: x86_64-unknown-linux-gnu release: 1.93.0-nightly LLVM version: 21.1.3 

Possibly related line of code:

type Other = SimplifiedType;
fn into_args(self) -> (DefId, SimplifiedType) {
(self.0.as_def_id(), self.1)
}
}
provide! { tcx, def_id, other, cdata,
explicit_item_bounds => { table_defaulted_array }
explicit_item_self_bounds => { table_defaulted_array }
explicit_predicates_of => { table }
generics_of => { table }
inferred_outlives_of => { table_defaulted_array }
explicit_super_predicates_of => { table_defaulted_array }

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zincremental-verify-ich=yes -Cincremental=<dir> -Cdebuginfo=2 -Clink-dead-code=true -Zvalidate-mir -Zquery-dep-graph -Zthreads=4 --edition=2024

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.lw7Ljes8uH6W/rustc_testrunner_tmpdir_reporting.Iw1HM8tcwzkj/mvce.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 error[E0601]: `main` function not found in crate `mvce` --> /tmp/icemaker_global_tempdir.lw7Ljes8uH6W/rustc_testrunner_tmpdir_reporting.Iw1HM8tcwzkj/mvce.rs:4:48 | 4 | impl Foo for [u8; std::path::MAIN_SEPARATOR] {} | ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.lw7Ljes8uH6W/rustc_testrunner_tmpdir_reporting.Iw1HM8tcwzkj/mvce.rs` thread 'rustc' (2141391) panicked at compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:224:1: DefId(1:5606 ~ std[b4c0]::path::MAIN_SEPARATOR) does not have a "const_of_item" stack backtrace: 0: 0x7ffaa066c9c3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h0dc93c2810c40bd0 1: 0x7ffaa0e01afc - core::fmt::write::hacdaf2bbd154e9b5 2: 0x7ffaa0621533 - std::io::Write::write_fmt::h75e948926e9dfbe3 3: 0x7ffaa0632b42 - std::sys::backtrace::BacktraceLock::print::h251013828edeee18 4: 0x7ffaa0638b99 - std::panicking::default_hook::{{closure}}::hf6c9462acd913055 5: 0x7ffaa06386c3 - std::panicking::default_hook::h4c9fd5029d2f8b73 6: 0x7ffa9f62a721 - std[b4c06921f787550c]::panicking::update_hook::<alloc[7ed4a9fe7ec582b8]::boxed::Box<rustc_driver_impl[87c4f5c8377f9862]::install_ice_hook::{closure#1}>>::{closure#0} 7: 0x7ffaa0638fbf - std::panicking::panic_with_hook::h02a757165762df79 8: 0x7ffaa0638d7a - std::panicking::panic_handler::{{closure}}::h66210c1b0223aa50 9: 0x7ffaa0632c79 - std::sys::backtrace::__rust_end_short_backtrace::h24c6c4da1001b922 10: 0x7ffaa061387d - __rustc[90cdb7b664da1e1e]::rust_begin_unwind 11: 0x7ffa9d6ba730 - core::panicking::panic_fmt::hb5559fbca70a856c 12: 0x7ffa9fbbc1a2 - rustc_metadata[cb4a4348587efc7]::rmeta::decoder::cstore_impl::provide_extern::const_of_item::{closure#2} 13: 0x7ffa9fbc7f6c - rustc_metadata[cb4a4348587efc7]::rmeta::decoder::cstore_impl::provide_extern::const_of_item 14: 0x7ffaa000b78b - rustc_query_impl[d4db0883806fa552]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d4db0883806fa552]::query_impl::const_of_item::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1e1513fa521466b3]::query::erase::Erased<[u8; 8usize]>> 15: 0x7ffaa12687c1 - rustc_query_system[d03d33f2f2d15895]::query::plumbing::try_execute_query::<rustc_query_impl[d4db0883806fa552]::DynamicConfig<rustc_query_system[d03d33f2f2d15895]::query::caches::DefIdCache<rustc_middle[1e1513fa521466b3]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[d4db0883806fa552]::plumbing::QueryCtxt, true> 16: 0x7ffaa00a56b7 - rustc_query_impl[d4db0883806fa552]::query_impl::const_of_item::get_query_incr::__rust_end_short_backtrace 17: 0x7ffaa226cbdd - <rustc_trait_selection[bb82b8f413fd2a2a]::traits::normalize::AssocTypeNormalizer>::normalize_free_alias::{closure#0} 18: 0x7ffaa10215aa - <rustc_trait_selection[bb82b8f413fd2a2a]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[a0e454d4d0a700c1]::fold::TypeFolder<rustc_middle[1e1513fa521466b3]::ty::context::TyCtxt>>::fold_const 19: 0x7ffaa1023bd7 - <rustc_middle[1e1513fa521466b3]::ty::Ty as rustc_type_ir[a0e454d4d0a700c1]::fold::TypeSuperFoldable<rustc_middle[1e1513fa521466b3]::ty::context::TyCtxt>>::super_fold_with::<rustc_trait_selection[bb82b8f413fd2a2a]::traits::normalize::AssocTypeNormalizer> 20: 0x7ffaa14878c4 - <&rustc_middle[1e1513fa521466b3]::ty::list::RawList<(), rustc_middle[1e1513fa521466b3]::ty::generic_args::GenericArg> as rustc_type_ir[a0e454d4d0a700c1]::fold::TypeFoldable<rustc_middle[1e1513fa521466b3]::ty::context::TyCtxt>>::fold_with::<rustc_trait_selection[bb82b8f413fd2a2a]::traits::normalize::AssocTypeNormalizer> 21: 0x7ffaa170f603 - rustc_trait_selection[bb82b8f413fd2a2a]::traits::normalize::normalize_with_depth_to::<rustc_type_ir[a0e454d4d0a700c1]::predicate::TraitRef<rustc_middle[1e1513fa521466b3]::ty::context::TyCtxt>>::{closure#0} 22: 0x7ffaa17101b1 - rustc_hir_analysis[3bbcf63e422e422d]::check::wfcheck::check_impl 23: 0x7ffaa160ef37 - rustc_hir_analysis[3bbcf63e422e422d]::check::check::check_item_type 24: 0x7ffaa160c41c - rustc_hir_analysis[3bbcf63e422e422d]::check::wfcheck::check_well_formed 25: 0x7ffaa160c3f5 - rustc_query_impl[d4db0883806fa552]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d4db0883806fa552]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1e1513fa521466b3]::query::erase::Erased<[u8; 1usize]>> 26: 0x7ffaa0f05c21 - rustc_query_system[d03d33f2f2d15895]::query::plumbing::try_execute_query::<rustc_query_impl[d4db0883806fa552]::DynamicConfig<rustc_data_structures[aff1d8a073485c2a]::vec_cache::VecCache<rustc_span[39972e28049286de]::def_id::LocalDefId, rustc_middle[1e1513fa521466b3]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[d03d33f2f2d15895]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[d4db0883806fa552]::plumbing::QueryCtxt, true> 27: 0x7ffaa0f03f6d - rustc_query_impl[d4db0883806fa552]::query_impl::check_well_formed::get_query_incr::__rust_end_short_backtrace 28: 0x7ffa9f75682b - rustc_middle[1e1513fa521466b3]::query::inner::query_ensure_error_guaranteed::<rustc_data_structures[aff1d8a073485c2a]::vec_cache::VecCache<rustc_span[39972e28049286de]::def_id::LocalDefId, rustc_middle[1e1513fa521466b3]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[d03d33f2f2d15895]::dep_graph::graph::DepNodeIndex>, ()> 29: 0x7ffa9f76727e - rustc_data_structures[aff1d8a073485c2a]::sync::parallel::par_slice::par_rec::<&rustc_hir[2565f01ea710f611]::hir::ItemId, rustc_data_structures[aff1d8a073485c2a]::sync::parallel::try_par_for_each_in<&[rustc_hir[2565f01ea710f611]::hir::ItemId], rustc_span[39972e28049286de]::ErrorGuaranteed, <rustc_middle[1e1513fa521466b3]::hir::ModuleItems>::par_items<rustc_hir_analysis[3bbcf63e422e422d]::check::wfcheck::check_type_wf::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}> 30: 0x7ffa9f7a0644 - rustc_thread_pool[80e8a9b643659d2e]::join::join_context::<rustc_thread_pool[80e8a9b643659d2e]::join::join::call<(), rustc_data_structures[aff1d8a073485c2a]::sync::parallel::par_slice::par_rec<&rustc_hir[2565f01ea710f611]::hir::ItemId, rustc_data_structures[aff1d8a073485c2a]::sync::parallel::try_par_for_each_in<&[rustc_hir[2565f01ea710f611]::hir::ItemId], rustc_span[39972e28049286de]::ErrorGuaranteed, <rustc_middle[1e1513fa521466b3]::hir::ModuleItems>::par_items<rustc_hir_analysis[3bbcf63e422e422d]::check::wfcheck::check_type_wf::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>::{closure#1}>::{closure#0}, rustc_thread_pool[80e8a9b643659d2e]::join::join::call<(), rustc_data_structures[aff1d8a073485c2a]::sync::parallel::par_slice::par_rec<&rustc_hir[2565f01ea710f611]::hir::ItemId, rustc_data_structures[aff1d8a073485c2a]::sync::parallel::try_par_for_each_in<&[rustc_hir[2565f01ea710f611]::hir::ItemId], rustc_span[39972e28049286de]::ErrorGuaranteed, <rustc_middle[1e1513fa521466b3]::hir::ModuleItems>::par_items<rustc_hir_analysis[3bbcf63e422e422d]::check::wfcheck::check_type_wf::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>::{closure#2}>::{closure#0}, (), ()>::{closure#0} 31: 0x7ffa9f767325 - rustc_data_structures[aff1d8a073485c2a]::sync::parallel::par_slice::par_rec::<&rustc_hir[2565f01ea710f611]::hir::ItemId, rustc_data_structures[aff1d8a073485c2a]::sync::parallel::try_par_for_each_in<&[rustc_hir[2565f01ea710f611]::hir::ItemId], rustc_span[39972e28049286de]::ErrorGuaranteed, <rustc_middle[1e1513fa521466b3]::hir::ModuleItems>::par_items<rustc_hir_analysis[3bbcf63e422e422d]::check::wfcheck::check_type_wf::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}> 32: 0x7ffa9f829b37 - <rustc_thread_pool[80e8a9b643659d2e]::job::StackJob<rustc_thread_pool[80e8a9b643659d2e]::latch::SpinLatch, rustc_thread_pool[80e8a9b643659d2e]::join::join_context<rustc_thread_pool[80e8a9b643659d2e]::join::join::call<(), rustc_data_structures[aff1d8a073485c2a]::sync::parallel::par_slice::par_rec<&rustc_hir[2565f01ea710f611]::hir::ItemId, rustc_data_structures[aff1d8a073485c2a]::sync::parallel::try_par_for_each_in<&[rustc_hir[2565f01ea710f611]::hir::ItemId], rustc_span[39972e28049286de]::ErrorGuaranteed, <rustc_middle[1e1513fa521466b3]::hir::ModuleItems>::par_items<rustc_hir_analysis[3bbcf63e422e422d]::check::wfcheck::check_type_wf::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>::{closure#1}>::{closure#0}, rustc_thread_pool[80e8a9b643659d2e]::join::join::call<(), rustc_data_structures[aff1d8a073485c2a]::sync::parallel::par_slice::par_rec<&rustc_hir[2565f01ea710f611]::hir::ItemId, rustc_data_structures[aff1d8a073485c2a]::sync::parallel::try_par_for_each_in<&[rustc_hir[2565f01ea710f611]::hir::ItemId], rustc_span[39972e28049286de]::ErrorGuaranteed, <rustc_middle[1e1513fa521466b3]::hir::ModuleItems>::par_items<rustc_hir_analysis[3bbcf63e422e422d]::check::wfcheck::check_type_wf::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>::{closure#2}>::{closure#0}, (), ()>::{closure#0}::{closure#0}, ()> as rustc_thread_pool[80e8a9b643659d2e]::job::Job>::execute 33: 0x7ffaa034362f - <rustc_thread_pool[80e8a9b643659d2e]::registry::WorkerThread>::wait_or_steal_until_cold 34: 0x7ffaa03420d1 - <rustc_thread_pool[80e8a9b643659d2e]::registry::ThreadBuilder>::run 35: 0x7ffa9f62284d - std[b4c06921f787550c]::sys::backtrace::__rust_begin_short_backtrace::<<rustc_thread_pool[80e8a9b643659d2e]::ThreadPoolBuilder>::build_scoped<rustc_interface[df9ddd9c9467ef8b]::util::run_in_thread_pool_with_globals<rustc_interface[df9ddd9c9467ef8b]::interface::run_compiler<(), rustc_driver_impl[87c4f5c8377f9862]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#5}::{closure#0}::{closure#0}, rustc_interface[df9ddd9c9467ef8b]::util::run_in_thread_pool_with_globals<rustc_interface[df9ddd9c9467ef8b]::interface::run_compiler<(), rustc_driver_impl[87c4f5c8377f9862]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#5}::{closure#0}::{closure#1}, ()>::{closure#0}::{closure#0}::{closure#0}, ()> 36: 0x7ffa9f62dd52 - <<std[b4c06921f787550c]::thread::Builder>::spawn_unchecked_<<rustc_thread_pool[80e8a9b643659d2e]::ThreadPoolBuilder>::build_scoped<rustc_interface[df9ddd9c9467ef8b]::util::run_in_thread_pool_with_globals<rustc_interface[df9ddd9c9467ef8b]::interface::run_compiler<(), rustc_driver_impl[87c4f5c8377f9862]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#5}::{closure#0}::{closure#0}, rustc_interface[df9ddd9c9467ef8b]::util::run_in_thread_pool_with_globals<rustc_interface[df9ddd9c9467ef8b]::interface::run_compiler<(), rustc_driver_impl[87c4f5c8377f9862]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#5}::{closure#0}::{closure#1}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>::{closure#1} as core[f1f7c8de62d6692e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 37: 0x7ffaa1c8afef - std::sys::thread::unix::Thread::new::thread_start::h6ee5f4a2e2de181d 38: 0x7ffa9b6969cb - <unknown> 39: 0x7ffa9b71aa0c - <unknown> 40: 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.93.0-nightly (acda5e9f9 2025-11-09) running on x86_64-unknown-linux-gnu note: compiler flags: -Z incremental-verify-ich=yes -C incremental=[REDACTED] -C debuginfo=2 -C link-dead-code=true -Z validate-mir -Z query-dep-graph -Z threads=4 query stack during panic: #0 [const_of_item] computing the type-level value for `std::path::MAIN_SEPARATOR` #1 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.lw7Ljes8uH6W/rustc_testrunner_tmpdir_reporting.Iw1HM8tcwzkj/mvce.rs:4:1: 4:45>` is well-formed #2 [check_type_wf] checking that types are well-formed #3 [analysis] running analysis passes on crate `mvce` end of query stack error: aborting due to 1 previous error; 1 warning emitted For more information about this error, try `rustc --explain E0601`. 

@rustbot label +F-min_generic_const_args +-Zvalidate-mir

Metadata

Metadata

Assignees

No one assigned

    Labels

    -Zvalidate-mirUnstable option: MIR validationC-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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions