-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Closed
Closed
Copy link
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-min_generic_const_args`#![feature(min_generic_const_args)]``#![feature(min_generic_const_args)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
found while checking #151246
auto-reduced (treereduce-rust):
#[type_const]
const TYPE_CONST: usize = 0;
fn main() {
println!("{}", TYPE_CONST);
}original:
#![feature(min_generic_const_args)]
#[type_const]
const TYPE_CONST: usize = 0;
fn main() {
println!("{}", TYPE_CONST);
}Version information
rustc 1.94.0-nightly (9f6cd6def 2026-01-17)
binary: rustc
commit-hash: 9f6cd6defbd7ef13f6777aa8e43b14d69f0a830a
commit-date: 2026-01-17
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.8
Possibly related line of code:
rust/compiler/rustc_const_eval/src/check_consts/qualifs.rs
Lines 349 to 361 in 9f6cd6d
| ty::ConstKind::Param(_) | ty::ConstKind::Error(_) | ty::ConstKind::Value(_) | |
| ) => | |
| { | |
| None | |
| } | |
| Const::Ty(_, c) => { | |
| bug!("expected ConstKind::Param or ConstKind::Value here, found {:?}", c) | |
| } | |
| Const::Unevaluated(uv, _) => Some(uv), | |
| Const::Val(..) => None, | |
| }; | |
| if let Some(mir::UnevaluatedConst { def, args: _, promoted }) = uneval { |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0658]: the `#[type_const]` attribute is an experimental feature
--> /tmp/icemaker_global_tempdir.nCODRSE2hJHl/rustc_testrunner_tmpdir_reporting.OU1QPg3STqeA/mvce.rs:1:1
|
1 | #[type_const]
| ^^^^^^^^^^^^^
|
= note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information
= help: add `#![feature(min_generic_const_args)]` to the crate attributes to enable
= note: this compiler was built on 2026-01-17; consider upgrading it if it is out of date
error: internal compiler error: /rustc-dev/9f6cd6defbd7ef13f6777aa8e43b14d69f0a830a/compiler/rustc_const_eval/src/check_consts/qualifs.rs:355:13: expected ConstKind::Param or ConstKind::Value here, found UnevaluatedConst { def: DefId(0:3 ~ mvce[19d4]::TYPE_CONST), args: [] }
thread 'rustc' (1566897) panicked at /rustc-dev/9f6cd6defbd7ef13f6777aa8e43b14d69f0a830a/compiler/rustc_const_eval/src/check_consts/qualifs.rs:355:13:
Box<dyn Any>
stack backtrace:
0: 0x7f0ee4038413 - <<std[5563efb7f247ea34]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[6067e6f2671c3dd]::fmt::Display>::fmt
1: 0x7f0ee460e2c8 - core[6067e6f2671c3dd]::fmt::write
2: 0x7f0ee404ee06 - <std[5563efb7f247ea34]::sys::stdio::unix::Stderr as std[5563efb7f247ea34]::io::Write>::write_fmt
3: 0x7f0ee400e488 - std[5563efb7f247ea34]::panicking::default_hook::{closure#0}
4: 0x7f0ee402bb43 - std[5563efb7f247ea34]::panicking::default_hook
5: 0x7f0ee2fffeba - std[5563efb7f247ea34]::panicking::update_hook::<alloc[fff5fa3571839cce]::boxed::Box<rustc_driver_impl[c32a203bb6815f6e]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7f0ee402be22 - std[5563efb7f247ea34]::panicking::panic_with_hook
7: 0x7f0ee303cef1 - std[5563efb7f247ea34]::panicking::begin_panic::<rustc_errors[1785ae46fd47b5e]::ExplicitBug>::{closure#0}
8: 0x7f0ee302d316 - std[5563efb7f247ea34]::sys::backtrace::__rust_end_short_backtrace::<std[5563efb7f247ea34]::panicking::begin_panic<rustc_errors[1785ae46fd47b5e]::ExplicitBug>::{closure#0}, !>
9: 0x7f0ee302a7e9 - std[5563efb7f247ea34]::panicking::begin_panic::<rustc_errors[1785ae46fd47b5e]::ExplicitBug>
10: 0x7f0ee305ac31 - <rustc_errors[1785ae46fd47b5e]::diagnostic::BugAbort as rustc_errors[1785ae46fd47b5e]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
11: 0x7f0ee360b8c9 - rustc_middle[38e34eab80c5dffd]::util::bug::opt_span_bug_fmt::<rustc_span[657f64d7c3ae02a8]::span_encoding::Span>::{closure#0}
12: 0x7f0ee360ba52 - rustc_middle[38e34eab80c5dffd]::ty::context::tls::with_opt::<rustc_middle[38e34eab80c5dffd]::util::bug::opt_span_bug_fmt<rustc_span[657f64d7c3ae02a8]::span_encoding::Span>::{closure#0}, !>::{closure#0}
13: 0x7f0ee35fcb6b - rustc_middle[38e34eab80c5dffd]::ty::context::tls::with_context_opt::<rustc_middle[38e34eab80c5dffd]::ty::context::tls::with_opt<rustc_middle[38e34eab80c5dffd]::util::bug::opt_span_bug_fmt<rustc_span[657f64d7c3ae02a8]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
14: 0x7f0ee0a93b24 - rustc_middle[38e34eab80c5dffd]::util::bug::bug_fmt
15: 0x7f0ee530aad3 - <rustc_mir_transform[11b2c2a9f8c4b61b]::promote_consts::Validator>::qualif_local::<rustc_const_eval[cbdfe2fb56c8e13d]::check_consts::qualifs::NeedsDrop>
16: 0x7f0ee5303402 - <rustc_mir_transform[11b2c2a9f8c4b61b]::promote_consts::PromoteTemps as rustc_mir_transform[11b2c2a9f8c4b61b]::pass_manager::MirPass>::run_pass
17: 0x7f0ee53148c9 - rustc_mir_transform[11b2c2a9f8c4b61b]::mir_promoted
18: 0x7f0ee5313c92 - rustc_query_impl[c90c15b3cf9dcc59]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c90c15b3cf9dcc59]::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle[38e34eab80c5dffd]::query::erase::Erased<[u8; 16usize]>>
19: 0x7f0ee50f7175 - rustc_query_system[e01d75cc3ad2d928]::query::plumbing::try_execute_query::<rustc_query_impl[c90c15b3cf9dcc59]::DynamicConfig<rustc_data_structures[c206126045f600c6]::vec_cache::VecCache<rustc_span[657f64d7c3ae02a8]::def_id::LocalDefId, rustc_middle[38e34eab80c5dffd]::query::erase::Erased<[u8; 16usize]>, rustc_query_system[e01d75cc3ad2d928]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[c90c15b3cf9dcc59]::plumbing::QueryCtxt, false>
20: 0x7f0ee50f6d16 - rustc_query_impl[c90c15b3cf9dcc59]::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
21: 0x7f0ee57c2e25 - rustc_query_impl[c90c15b3cf9dcc59]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c90c15b3cf9dcc59]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[38e34eab80c5dffd]::query::erase::Erased<[u8; 8usize]>>
22: 0x7f0ee475582a - rustc_query_system[e01d75cc3ad2d928]::query::plumbing::try_execute_query::<rustc_query_impl[c90c15b3cf9dcc59]::DynamicConfig<rustc_data_structures[c206126045f600c6]::vec_cache::VecCache<rustc_span[657f64d7c3ae02a8]::def_id::LocalDefId, rustc_middle[38e34eab80c5dffd]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[e01d75cc3ad2d928]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[c90c15b3cf9dcc59]::plumbing::QueryCtxt, false>
23: 0x7f0ee474c599 - rustc_query_impl[c90c15b3cf9dcc59]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
24: 0x7f0ee474c7b7 - <rustc_middle[38e34eab80c5dffd]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[8f5d8f9a48cb0e5b]::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}
25: 0x7f0ee474a20a - rustc_interface[8f5d8f9a48cb0e5b]::passes::analysis
26: 0x7f0ee4749627 - rustc_query_impl[c90c15b3cf9dcc59]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c90c15b3cf9dcc59]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[38e34eab80c5dffd]::query::erase::Erased<[u8; 0usize]>>
27: 0x7f0ee580f863 - rustc_query_system[e01d75cc3ad2d928]::query::plumbing::try_execute_query::<rustc_query_impl[c90c15b3cf9dcc59]::DynamicConfig<rustc_query_system[e01d75cc3ad2d928]::query::caches::SingleCache<rustc_middle[38e34eab80c5dffd]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[c90c15b3cf9dcc59]::plumbing::QueryCtxt, false>
28: 0x7f0ee580f64e - rustc_query_impl[c90c15b3cf9dcc59]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
29: 0x7f0ee5983751 - <rustc_interface[8f5d8f9a48cb0e5b]::passes::create_and_enter_global_ctxt<core[6067e6f2671c3dd]::option::Option<rustc_interface[8f5d8f9a48cb0e5b]::queries::Linker>, rustc_driver_impl[c32a203bb6815f6e]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[6067e6f2671c3dd]::ops::function::FnOnce<(&rustc_session[7ae56eb119035399]::session::Session, rustc_middle[38e34eab80c5dffd]::ty::context::CurrentGcx, alloc[fff5fa3571839cce]::sync::Arc<rustc_data_structures[c206126045f600c6]::jobserver::Proxy>, &std[5563efb7f247ea34]::sync::once_lock::OnceLock<rustc_middle[38e34eab80c5dffd]::ty::context::GlobalCtxt>, &rustc_data_structures[c206126045f600c6]::sync::worker_local::WorkerLocal<rustc_middle[38e34eab80c5dffd]::arena::Arena>, &rustc_data_structures[c206126045f600c6]::sync::worker_local::WorkerLocal<rustc_hir[fa6d62530edb3226]::Arena>, rustc_driver_impl[c32a203bb6815f6e]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
30: 0x7f0ee5862c74 - rustc_interface[8f5d8f9a48cb0e5b]::interface::run_compiler::<(), rustc_driver_impl[c32a203bb6815f6e]::run_compiler::{closure#0}>::{closure#1}
31: 0x7f0ee57065ce - std[5563efb7f247ea34]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[8f5d8f9a48cb0e5b]::util::run_in_thread_with_globals<rustc_interface[8f5d8f9a48cb0e5b]::util::run_in_thread_pool_with_globals<rustc_interface[8f5d8f9a48cb0e5b]::interface::run_compiler<(), rustc_driver_impl[c32a203bb6815f6e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
32: 0x7f0ee57063a0 - <std[5563efb7f247ea34]::thread::lifecycle::spawn_unchecked<rustc_interface[8f5d8f9a48cb0e5b]::util::run_in_thread_with_globals<rustc_interface[8f5d8f9a48cb0e5b]::util::run_in_thread_pool_with_globals<rustc_interface[8f5d8f9a48cb0e5b]::interface::run_compiler<(), rustc_driver_impl[c32a203bb6815f6e]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[6067e6f2671c3dd]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
33: 0x7f0ee5708546 - <std[5563efb7f247ea34]::sys::thread::unix::Thread>::new::thread_start
34: 0x7f0edf09698b - <unknown>
35: 0x7f0edf11a9cc - <unknown>
36: 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.94.0-nightly (9f6cd6def 2026-01-17) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [mir_promoted] promoting constants in MIR for `main`
#1 [mir_borrowck] borrow-checking `main`
#2 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.
@rustbot label +F-min_generic_const_args
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-min_generic_const_args`#![feature(min_generic_const_args)]``#![feature(min_generic_const_args)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.