Repository navigation
Labels
C-bugCategory: This is a bug.F-gca_const_items`#![feature(gca_const_items)]` (previously: `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.
Description
Code
Apparently needs two crates to reproduce.
// up/src/lib.rs
#![feature(gca_min_const_items, gca_const_items)]
#![expect(incomplete_features)]
pub const N: usize = std::gca!(1);// down/src/main.rs
const N: usize = up::N;
fn main() {
println!("{N}");
}Meta
rustc --version --verbose:
rustc 1.102.0-nightly (137d1d494 2026-11-22)
binary: rustc
commit-hash: 137d1d49458b73b7b85d2c1599d8730886d65e47
commit-date: 2026-11-22
host: x86_64-unknown-linux-gnu
release: 1.102.0-nightly
LLVM version: 23.1.6
Error output
thread 'rustc' panicked at /rustc-dev/137d1d49458b73b7b85d2c1599d8730886d65e47/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:230:1:
DefId(20:3 ~ up[3832]::N) does not have a "mir_for_ctfe"
Backtrace
thread 'rustc' panicked at /rustc-dev/137d1d49458b73b7b85d2c1599d8730886d65e47/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:230:1:
DefId(20:3 ~ up[3832]::N) does not have a "mir_for_ctfe"
stack backtrace:
0: 0x7f072c5e8995 - <std[2523633ee8305b4d]::backtrace::Backtrace>::create
1: 0x7f072c5e88e5 - <std[2523633ee8305b4d]::backtrace::Backtrace>::force_capture
2: 0x7f072b3529c2 - std[2523633ee8305b4d]::panicking::update_hook::<alloc[2c3ae582425e8a41]::boxed::Box<rustc_driver_impl[f75eeb1fdef0f151]::install_ice_hook::{closure#1}>>::{closure#0}
3: 0x7f072c5feb02 - std[2523633ee8305b4d]::panicking::panic_with_hook
4: 0x7f072c5dc152 - std[2523633ee8305b4d]::panicking::panic_handler::{closure#0}
5: 0x7f072c5d47c9 - std[2523633ee8305b4d]::sys::backtrace::__rust_end_short_backtrace::<std[2523633ee8305b4d]::panicking::panic_handler::{closure#0}, !>
6: 0x7f072c5ddead - __rustc[ad48b8b8d23b8573]::rust_begin_unwind
7: 0x7f0728c926bc - core[223e4cb31e52ec21]::panicking::panic_fmt
8: 0x7f07292b3761 - rustc_metadata[fad79a0bac71ee95]::rmeta::decoder::cstore_impl::provide_extern::mir_for_ctfe::{closure#1}
9: 0x7f072df0ebc2 - rustc_metadata[fad79a0bac71ee95]::rmeta::decoder::cstore_impl::provide_extern::mir_for_ctfe
10: 0x7f072df0e6df - rustc_query_impl[49b2a64adeb9be21]::query_vtables::mir_for_ctfe::invoke_provider_fn::__rust_begin_short_backtrace
11: 0x7f072cedd2c7 - rustc_query_impl[49b2a64adeb9be21]::execution::try_execute_query::<rustc_middle[b92680e11becc0cb]::query::caches::DefIdCache<rustc_middle[b92680e11becc0cb]::query::erase::ErasedData<[u8; 8usize]>>, true>
12: 0x7f072cecf23f - rustc_query_impl[49b2a64adeb9be21]::query_vtables::mir_for_ctfe::execute_query_incr::__rust_end_short_backtrace
13: 0x7f072d9d57b9 - <rustc_const_eval[2c8f65c46fbcdfc3]::interpret::eval_context::InterpCx<rustc_const_eval[2c8f65c46fbcdfc3]::const_eval::machine::CompileTimeMachine>>::load_mir
14: 0x7f072a58431a - rustc_const_eval[2c8f65c46fbcdfc3]::const_eval::eval_queries::eval_to_allocation_raw_provider
15: 0x7f072cc17956 - rustc_query_impl[49b2a64adeb9be21]::query_vtables::eval_to_allocation_raw::invoke_provider_fn::__rust_begin_short_backtrace
16: 0x7f072decadd6 - rustc_query_impl[49b2a64adeb9be21]::execution::try_execute_query::<rustc_middle[b92680e11becc0cb]::query::caches::DefaultCache<rustc_middle[b92680e11becc0cb]::ty::PseudoCanonicalInput<rustc_middle[b92680e11becc0cb]::mir::interpret::GlobalId>, rustc_middle[b92680e11becc0cb]::query::erase::ErasedData<[u8; 24usize]>>, true>
17: 0x7f072d4b2111 - rustc_query_impl[49b2a64adeb9be21]::query_vtables::eval_to_allocation_raw::execute_query_incr::__rust_end_short_backtrace
18: 0x7f072d05ef27 - rustc_const_eval[2c8f65c46fbcdfc3]::const_eval::eval_queries::eval_to_const_value_raw_provider
19: 0x7f072d05eb96 - rustc_query_impl[49b2a64adeb9be21]::query_vtables::eval_to_const_value_raw::invoke_provider_fn::__rust_begin_short_backtrace
20: 0x7f072decadd6 - rustc_query_impl[49b2a64adeb9be21]::execution::try_execute_query::<rustc_middle[b92680e11becc0cb]::query::caches::DefaultCache<rustc_middle[b92680e11becc0cb]::ty::PseudoCanonicalInput<rustc_middle[b92680e11becc0cb]::mir::interpret::GlobalId>, rustc_middle[b92680e11becc0cb]::query::erase::ErasedData<[u8; 24usize]>>, true>
21: 0x7f072d4ae1f0 - rustc_query_impl[49b2a64adeb9be21]::query_vtables::eval_to_const_value_raw::execute_query_incr::__rust_end_short_backtrace
22: 0x7f072cd39f9c - <rustc_middle[b92680e11becc0cb]::ty::context::TyCtxt>::const_eval_resolve
23: 0x7f072cd39051 - <rustc_middle[b92680e11becc0cb]::mir::consts::Const>::eval
24: 0x7f072cd131cc - <rustc_const_eval[2c8f65c46fbcdfc3]::interpret::eval_context::InterpCx<rustc_const_eval[2c8f65c46fbcdfc3]::const_eval::machine::CompileTimeMachine>>::push_stack_frame_raw
25: 0x7f072a58463d - rustc_const_eval[2c8f65c46fbcdfc3]::const_eval::eval_queries::eval_to_allocation_raw_provider
26: 0x7f072cc17956 - rustc_query_impl[49b2a64adeb9be21]::query_vtables::eval_to_allocation_raw::invoke_provider_fn::__rust_begin_short_backtrace
27: 0x7f072decadd6 - rustc_query_impl[49b2a64adeb9be21]::execution::try_execute_query::<rustc_middle[b92680e11becc0cb]::query::caches::DefaultCache<rustc_middle[b92680e11becc0cb]::ty::PseudoCanonicalInput<rustc_middle[b92680e11becc0cb]::mir::interpret::GlobalId>, rustc_middle[b92680e11becc0cb]::query::erase::ErasedData<[u8; 24usize]>>, true>
28: 0x7f072d4b2111 - rustc_query_impl[49b2a64adeb9be21]::query_vtables::eval_to_allocation_raw::execute_query_incr::__rust_end_short_backtrace
29: 0x7f072d05ef27 - rustc_const_eval[2c8f65c46fbcdfc3]::const_eval::eval_queries::eval_to_const_value_raw_provider
30: 0x7f072d05eb96 - rustc_query_impl[49b2a64adeb9be21]::query_vtables::eval_to_const_value_raw::invoke_provider_fn::__rust_begin_short_backtrace
31: 0x7f072decadd6 - rustc_query_impl[49b2a64adeb9be21]::execution::try_execute_query::<rustc_middle[b92680e11becc0cb]::query::caches::DefaultCache<rustc_middle[b92680e11becc0cb]::ty::PseudoCanonicalInput<rustc_middle[b92680e11becc0cb]::mir::interpret::GlobalId>, rustc_middle[b92680e11becc0cb]::query::erase::ErasedData<[u8; 24usize]>>, true>
32: 0x7f072d4ae1f0 - rustc_query_impl[49b2a64adeb9be21]::query_vtables::eval_to_const_value_raw::execute_query_incr::__rust_end_short_backtrace
33: 0x7f072d05fa7c - rustc_const_eval[2c8f65c46fbcdfc3]::const_eval::eval_queries::eval_to_const_value_raw_provider
34: 0x7f072d05eb96 - rustc_query_impl[49b2a64adeb9be21]::query_vtables::eval_to_const_value_raw::invoke_provider_fn::__rust_begin_short_backtrace
35: 0x7f072decadd6 - rustc_query_impl[49b2a64adeb9be21]::execution::try_execute_query::<rustc_middle[b92680e11becc0cb]::query::caches::DefaultCache<rustc_middle[b92680e11becc0cb]::ty::PseudoCanonicalInput<rustc_middle[b92680e11becc0cb]::mir::interpret::GlobalId>, rustc_middle[b92680e11becc0cb]::query::erase::ErasedData<[u8; 24usize]>>, true>
36: 0x7f072d4ae1f0 - rustc_query_impl[49b2a64adeb9be21]::query_vtables::eval_to_const_value_raw::execute_query_incr::__rust_end_short_backtrace
37: 0x7f072d264a30 - <rustc_middle[b92680e11becc0cb]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[d80e6ed05c85f744]::check_crate::{closure#1}>::{closure#0}
38: 0x7f072b4eeab9 - rustc_thread_pool[c6737c4d7feac3d4]::scope::scope::<rustc_data_structures[9378599a7d92b22a]::sync::parallel::par_range_internal<rustc_data_structures[9378599a7d92b22a]::sync::parallel::par_for_each_in<rustc_span[c3ecf68a2e0e302e]::def_id::LocalDefId, [rustc_span[c3ecf68a2e0e302e]::def_id::LocalDefId], <rustc_middle[b92680e11becc0cb]::ty::context::TyCtxt>::par_hir_body_owners<rustc_hir_analysis[d80e6ed05c85f744]::check_crate::{closure#1}>::{closure#0}>::{closure#0}::{closure#0}>::{closure#1}, ()>::{closure#0}
39: 0x7f072d263b14 - rustc_hir_analysis[d80e6ed05c85f744]::check_crate
40: 0x7f072d25d6e3 - rustc_interface[d08269662c266ea4]::passes::analysis
41: 0x7f072e1b0a6a - rustc_query_impl[49b2a64adeb9be21]::execution::try_execute_query::<rustc_middle[b92680e11becc0cb]::query::caches::SingleCache<rustc_middle[b92680e11becc0cb]::query::erase::ErasedData<[u8; 0usize]>>, true>
42: 0x7f072e1b031d - rustc_query_impl[49b2a64adeb9be21]::query_vtables::analysis::execute_query_incr::__rust_end_short_backtrace
43: 0x7f072dee5e1d - rustc_interface[d08269662c266ea4]::interface::run_compiler::<(), rustc_driver_impl[f75eeb1fdef0f151]::compiler_entrypoint::{closure#0}>::{closure#2}
44: 0x7f072e1d717e - <rustc_thread_pool[c6737c4d7feac3d4]::job::StackJob<rustc_thread_pool[c6737c4d7feac3d4]::latch::LatchRef<rustc_thread_pool[c6737c4d7feac3d4]::latch::LockLatch>, <rustc_thread_pool[c6737c4d7feac3d4]::registry::Registry>::in_worker_cold<<rustc_thread_pool[c6737c4d7feac3d4]::thread_pool::ThreadPool>::install<rustc_interface[d08269662c266ea4]::util::run_in_thread_pool_with_globals<rustc_interface[d08269662c266ea4]::interface::run_compiler<(), rustc_driver_impl[f75eeb1fdef0f151]::compiler_entrypoint::{closure#0}>::{closure#2}, ()>::{closure#6}::{closure#0}::{closure#1}::{closure#0}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> as rustc_thread_pool[c6737c4d7feac3d4]::job::Job>::execute
45: 0x7f072e1d7976 - <rustc_thread_pool[c6737c4d7feac3d4]::registry::WorkerThread>::wait_or_steal_until_cold
46: 0x7f072e1d8aa1 - <rustc_thread_pool[c6737c4d7feac3d4]::registry::ThreadBuilder>::run
47: 0x7f072e1d88ec - std[2523633ee8305b4d]::sys::backtrace::__rust_begin_short_backtrace::<<rustc_thread_pool[c6737c4d7feac3d4]::ThreadPoolBuilder>::build_scoped<rustc_interface[d08269662c266ea4]::util::run_in_thread_pool_with_globals<rustc_interface[d08269662c266ea4]::interface::run_compiler<(), rustc_driver_impl[f75eeb1fdef0f151]::compiler_entrypoint::{closure#0}>::{closure#2}, ()>::{closure#6}::{closure#0}::{closure#0}, rustc_interface[d08269662c266ea4]::util::run_in_thread_pool_with_globals<rustc_interface[d08269662c266ea4]::interface::run_compiler<(), rustc_driver_impl[f75eeb1fdef0f151]::compiler_entrypoint::{closure#0}>::{closure#2}, ()>::{closure#6}::{closure#0}::{closure#1}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>
48: 0x7f072e1d8784 - <std[2523633ee8305b4d]::thread::lifecycle::spawn_unchecked<<rustc_thread_pool[c6737c4d7feac3d4]::ThreadPoolBuilder>::build_scoped<rustc_interface[d08269662c266ea4]::util::run_in_thread_pool_with_globals<rustc_interface[d08269662c266ea4]::interface::run_compiler<(), rustc_driver_impl[f75eeb1fdef0f151]::compiler_entrypoint::{closure#0}>::{closure#2}, ()>::{closure#6}::{closure#0}::{closure#0}, rustc_interface[d08269662c266ea4]::util::run_in_thread_pool_with_globals<rustc_interface[d08269662c266ea4]::interface::run_compiler<(), rustc_driver_impl[f75eeb1fdef0f151]::compiler_entrypoint::{closure#0}>::{closure#2}, ()>::{closure#6}::{closure#0}::{closure#1}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>::{closure#1} as core[223e4cb31e52ec21]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
49: 0x7f072df4ca9d - <std[2523633ee8305b4d]::sys::thread::unix::Thread>::new::thread_start
50: 0x7f0726ea3dba - start_thread
at ./nptl/pthread_create.c:454:8
51: 0x7f0726f3758c - __GI___clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
52: 0x0 - <unknown>
rustc version: 1.102.0-nightly (137d1d494 2026-11-22)
platform: x86_64-unknown-linux-gnu
query stack during panic:
#0 [mir_for_ctfe] caching mir of `up::N` for CTFE
#1 [eval_to_allocation_raw] const-evaluating + checking `up::N`
#2 [eval_to_const_value_raw] simplifying constant for the type system `up::N`
#3 [eval_to_allocation_raw] const-evaluating + checking `N`
#4 [eval_to_const_value_raw] simplifying constant for the type system `N`
#5 [eval_to_const_value_raw] simplifying constant for the type system `N`
#6 [analysis] running analysis passes on crate `down`
end of query stack
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.F-gca_const_items`#![feature(gca_const_items)]` (previously: `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.
Activity
bit-aloo commentedon Nov 24, 2026
Ah! we compute the mir for direct const on fly for the compiling crate.. but never really store them in rmeta file. I think we need to add direct consts to mir_keys, so that the encoder writes its mir into the rmeta. That should do the trick
@rustbot claim
encode the synthesized mir of gca consts
Rollup merge of rust-lang#166435 - bit-aloo:2026-11-24-encode-direct-…
Rollup merge of rust-lang#166435 - bit-aloo:2026-11-24-encode-direct-…
Rollup merge of rust-lang#166435 - bit-aloo:2026-11-24-encode-direct-…
Rollup merge of rust-lang#166435 - bit-aloo:2026-11-24-encode-direct-…
Unrolled build for #166435 in rollup 166633