Repository navigation
Closed
Labels
C-bugCategory: This is a bug.F-gca_min_const_items`#![feature(gca_min_const_items)]` (previously: `min_generic_const_args`)F-generic_const_exprs`#![feature(generic_const_exprs)]`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
auto-reduced (treereduce-rust):
#![feature(generic_const_exprs)]
#![feature(min_generic_const_args)]
struct S<const N: usize = const {}>;original:
#![feature(generic_const_exprs)]
#![feature(min_generic_const_args)]
struct S<const N: usize = const {}>;
fn main() {}Version information
rustc 1.99.0-nightly (3ead112e6 2026-07-10)
binary: rustc
commit-hash: 3ead112e67f8feb4d6b09e12f1b5d83b87698961
commit-date: 2026-07-10
host: x86_64-unknown-linux-gnu
release: 1.99.0-nightly
LLVM version: 22.1.8
Possibly related line of code:
rust/compiler/rustc_hir_analysis/src/collect/generics_of.rs
Lines 138 to 150 in 3ead112
| // the def id of the `{ N + 1 }` anon const | |
| // struct Foo<const N: usize, const M: usize = { N + 1 }>; | |
| // | |
| // This has some implications for how we get the predicates available to the anon const | |
| // see `explicit_predicates_of` for more information on this | |
| let generics = tcx.generics_of(parent_did); | |
| let param_def_idx = generics.param_def_id_to_index[¶m_id.to_def_id()]; | |
| // In the above example this would be .params[..N#0] | |
| let own_params = generics.params_to(param_def_idx as usize, tcx).to_owned(); | |
| let param_def_id_to_index = | |
| own_params.iter().map(|param| (param.def_id, param.index)).collect(); | |
| return ty::Generics { |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
--> /tmp/icemaker_global_tempdir.TLyccH8Iv8XH/rustc_testrunner_tmpdir_reporting.zzyjAt4WvGZJ/mvce.rs:1:12
|
1 | #![feature(generic_const_exprs)]
| ^^^^^^^^^^^^^^^^^^^
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
= note: `#[warn(incomplete_features)]` on by default
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.TLyccH8Iv8XH/rustc_testrunner_tmpdir_reporting.zzyjAt4WvGZJ/mvce.rs:2:12
|
2 | #![feature(min_generic_const_args)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.TLyccH8Iv8XH/rustc_testrunner_tmpdir_reporting.zzyjAt4WvGZJ/mvce.rs:3:37
|
3 | struct S<const N: usize = const {}>;
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.TLyccH8Iv8XH/rustc_testrunner_tmpdir_reporting.zzyjAt4WvGZJ/mvce.rs`
thread 'rustc' (1590999) panicked at /rustc-dev/3ead112e67f8feb4d6b09e12f1b5d83b87698961/compiler/rustc_hir_analysis/src/collect/generics_of.rs:144:71:
no entry found for key
stack backtrace:
0: 0x7fbdf6205ea6 - <<std[d4f135fceff20c67]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[8edfacd32da865b7]::fmt::Display>::fmt
1: 0x7fbdf680f048 - core[8edfacd32da865b7]::fmt::write
2: 0x7fbdf621b28c - <std[d4f135fceff20c67]::sys::stdio::unix::Stderr as core[8edfacd32da865b7]::io::write::Write>::write_fmt
3: 0x7fbdf61da1aa - std[d4f135fceff20c67]::panicking::default_hook::{closure#0}
4: 0x7fbdf61f8563 - std[d4f135fceff20c67]::panicking::default_hook
5: 0x7fbdf51d2278 - std[d4f135fceff20c67]::panicking::update_hook::<alloc[704ad2876a93e90f]::boxed::Box<rustc_driver_impl[95f5b4d90ec18cd]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7fbdf61f8a02 - std[d4f135fceff20c67]::panicking::panic_with_hook
7: 0x7fbdf61da262 - std[d4f135fceff20c67]::panicking::panic_handler::{closure#0}
8: 0x7fbdf61d0f29 - std[d4f135fceff20c67]::sys::backtrace::__rust_end_short_backtrace::<std[d4f135fceff20c67]::panicking::panic_handler::{closure#0}, !>
9: 0x7fbdf61dbbcd - __rustc[66893301beac1672]::rust_begin_unwind
10: 0x7fbdf2f529bc - core[8edfacd32da865b7]::panicking::panic_fmt
11: 0x7fbdf43bb6b4 - core[8edfacd32da865b7]::option::expect_failed
12: 0x7fbdf36121db - rustc_hir_analysis[35a4c1b0f728325b]::collect::generics_of::generics_of
13: 0x7fbdf685186c - rustc_query_impl[695d6a66f50a35af]::query_impl::generics_of::invoke_provider_fn::__rust_begin_short_backtrace
14: 0x7fbdf6851f4d - rustc_query_impl[695d6a66f50a35af]::execution::try_execute_query::<rustc_middle[e07bb827b447d3fe]::query::caches::DefIdCache<rustc_middle[e07bb827b447d3fe]::query::erase::ErasedData<[u8; 8usize]>>, false>
15: 0x7fbdf6851c50 - rustc_query_impl[695d6a66f50a35af]::query_impl::generics_of::execute_query_non_incr::__rust_end_short_backtrace
16: 0x7fbdf6cc8bc8 - <rustc_middle[e07bb827b447d3fe]::ty::list::RawList<(), rustc_middle[e07bb827b447d3fe]::ty::generic_args::GenericArg>>::for_item::<<rustc_middle[e07bb827b447d3fe]::ty::list::RawList<(), rustc_middle[e07bb827b447d3fe]::ty::generic_args::GenericArg>>::identity_for_item<rustc_span[e9fff3168246b0b8]::def_id::DefId>::{closure#0}>
17: 0x7fbdf6df3fba - <dyn rustc_hir_analysis[35a4c1b0f728325b]::hir_ty_lowering::HirTyLowerer>::lower_const_arg
18: 0x7fbdf7fb4464 - rustc_hir_analysis[35a4c1b0f728325b]::collect::const_param_default
19: 0x7fbdf7fb428f - rustc_query_impl[695d6a66f50a35af]::query_impl::const_param_default::invoke_provider_fn::__rust_begin_short_backtrace
20: 0x7fbdf6851f4d - rustc_query_impl[695d6a66f50a35af]::execution::try_execute_query::<rustc_middle[e07bb827b447d3fe]::query::caches::DefIdCache<rustc_middle[e07bb827b447d3fe]::query::erase::ErasedData<[u8; 8usize]>>, false>
21: 0x7fbdf7fb4609 - rustc_query_impl[695d6a66f50a35af]::query_impl::const_param_default::execute_query_non_incr::__rust_end_short_backtrace
22: 0x7fbdf7609aaa - rustc_hir_analysis[35a4c1b0f728325b]::check::check::check_item_type
23: 0x7fbdf7605966 - rustc_hir_analysis[35a4c1b0f728325b]::check::wfcheck::check_well_formed
24: 0x7fbdf7605947 - rustc_query_impl[695d6a66f50a35af]::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
25: 0x7fbdf7604f25 - rustc_query_impl[695d6a66f50a35af]::execution::try_execute_query::<rustc_data_structures[af7bddd33ef5afd7]::vec_cache::VecCache<rustc_span[e9fff3168246b0b8]::def_id::LocalDefId, rustc_middle[e07bb827b447d3fe]::query::erase::ErasedData<[u8; 1usize]>, rustc_middle[e07bb827b447d3fe]::dep_graph::graph::DepNodeIndex>, false>
26: 0x7fbdf7604cbb - rustc_query_impl[695d6a66f50a35af]::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
27: 0x7fbdf75fffca - rustc_hir_analysis[35a4c1b0f728325b]::check::wfcheck::check_type_wf
28: 0x7fbdf75ffed3 - rustc_query_impl[695d6a66f50a35af]::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
29: 0x7fbdf7a2ea06 - rustc_query_impl[695d6a66f50a35af]::execution::try_execute_query::<rustc_middle[e07bb827b447d3fe]::query::caches::SingleCache<rustc_middle[e07bb827b447d3fe]::query::erase::ErasedData<[u8; 1usize]>>, false>
30: 0x7fbdf7a2e7e9 - rustc_query_impl[695d6a66f50a35af]::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
31: 0x7fbdf6dd6cb8 - rustc_hir_analysis[35a4c1b0f728325b]::check_crate
32: 0x7fbdf6c7b53f - rustc_interface[31794f0d8eea0243]::passes::analysis
33: 0x7fbdf7a2cf87 - rustc_query_impl[695d6a66f50a35af]::execution::try_execute_query::<rustc_middle[e07bb827b447d3fe]::query::caches::SingleCache<rustc_middle[e07bb827b447d3fe]::query::erase::ErasedData<[u8; 0usize]>>, false>
34: 0x7fbdf7a2cc7f - rustc_query_impl[695d6a66f50a35af]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
35: 0x7fbdf79aa889 - rustc_interface[31794f0d8eea0243]::interface::run_compiler::<(), rustc_driver_impl[95f5b4d90ec18cd]::run_compiler::{closure#0}>::{closure#1}
36: 0x7fbdf7a184ba - std[d4f135fceff20c67]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[31794f0d8eea0243]::util::run_in_thread_with_globals<rustc_interface[31794f0d8eea0243]::util::run_in_thread_pool_with_globals<rustc_interface[31794f0d8eea0243]::interface::run_compiler<(), rustc_driver_impl[95f5b4d90ec18cd]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
37: 0x7fbdf7a1826d - <std[d4f135fceff20c67]::thread::lifecycle::spawn_unchecked<rustc_interface[31794f0d8eea0243]::util::run_in_thread_with_globals<rustc_interface[31794f0d8eea0243]::util::run_in_thread_pool_with_globals<rustc_interface[31794f0d8eea0243]::interface::run_compiler<(), rustc_driver_impl[95f5b4d90ec18cd]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[8edfacd32da865b7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
38: 0x7fbdf7a1c690 - <std[d4f135fceff20c67]::sys::thread::unix::Thread>::new::thread_start
39: 0x7fbdf12981b9 - <unknown>
40: 0x7fbdf131d21c - <unknown>
41: 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.99.0-nightly (3ead112e6 2026-07-10) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [generics_of] computing generics of `S::{constant#0}::{constant#0}`
#1 [const_param_default] computing the default for const parameter `S::N`
#2 [check_well_formed] checking that `S` is well-formed
#3 [check_type_wf] checking that types are well-formed
#4 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 1 previous error; 2 warnings emitted
For more information about this error, try `rustc --explain E0601`.
@rustbot label +F-generic_const_exprs +F-min_generic_const_args
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.F-gca_min_const_items`#![feature(gca_min_const_items)]` (previously: `min_generic_const_args`)F-generic_const_exprs`#![feature(generic_const_exprs)]`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
matthiaskrgr commentedon Jul 10, 2026
this compiled yesterday, now it ICEs 🧊
Rollup merge of rust-lang#159303 - TaKO8Ki:fix-inline-const-generic-d…
Rollup merge of rust-lang#159303 - TaKO8Ki:fix-inline-const-generic-d…
Rollup merge of rust-lang#159303 - TaKO8Ki:fix-inline-const-generic-d…
Rollup merge of rust-lang#159303 - TaKO8Ki:fix-inline-const-generic-d…
Rollup merge of rust-lang#159303 - TaKO8Ki:fix-inline-const-generic-d…
Rollup merge of rust-lang#159303 - TaKO8Ki:fix-inline-const-generic-d…
Rollup merge of rust-lang#159303 - TaKO8Ki:fix-inline-const-generic-d…
Rollup merge of rust-lang#159303 - TaKO8Ki:fix-inline-const-generic-d…
Unrolled build for #159303