-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Open
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
auto-reduced (treereduce-rust):
#![feature(min_generic_const_args)]
struct Y {
stuff: [u8; { ([1, 2], 3, [4, 5]) }],
}
fn main() {}original:
//! Regression test for <https://github.com/rust-lang/rust/issues/79429>.
//@ revisions: full min
#![cfg_attr(full, feature(generic_const_exprs))]
#![cfg_attr(full, allow(incomplete_features))]
struct X<const S: usize>;
impl<const S: usize> X<S> {
const LEN: usize = S + 1; // `S + 1` is a valid const expression in this context.
}
struct Y<const S: usize> {
stuff: [u8; { ([1, 2], 3, [4, 5]) }], // `S + 1` is NOT a valid const expression in this context.
//[min]~^ ERROR generic parameters may not be used in const operations
//[full]~^^ ERROR unconstrained generic constant
}
fn main() {}Version information
rustc 1.94.0-nightly (2f1bd3f37 2026-01-12)
binary: rustc
commit-hash: 2f1bd3f3781c90a8447e37d65a898442b8618895
commit-date: 2026-01-12
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.8
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(min_generic_const_args)
Program output
warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
--> <crate attribute>: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
warning: unnecessary braces around const expression
--> /tmp/icemaker_global_tempdir.UUCuQafFqrCa/rustc_testrunner_tmpdir_reporting.eDmPz001jzuy/mvce.rs:2:17
|
2 | stuff: [u8; { ([1, 2], 3, [4, 5]) }],
| ^^ ^^
|
= note: `#[warn(unused_braces)]` (part of `#[warn(unused)]`) on by default
help: remove these braces
|
2 - stuff: [u8; { ([1, 2], 3, [4, 5]) }],
2 + stuff: [u8; ([1, 2], 3, [4, 5]) ],
|
warning: struct `Y` is never constructed
--> /tmp/icemaker_global_tempdir.UUCuQafFqrCa/rustc_testrunner_tmpdir_reporting.eDmPz001jzuy/mvce.rs:1:8
|
1 | struct Y {
| ^
|
= note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default
warning: 3 warnings emitted
note: no errors encountered even though delayed bugs were created
note: those delayed bugs will now be shown as internal compiler errors
error: internal compiler error: const tuple lack type information
--> /tmp/icemaker_global_tempdir.UUCuQafFqrCa/rustc_testrunner_tmpdir_reporting.eDmPz001jzuy/mvce.rs:2:19
|
2 | stuff: [u8; { ([1, 2], 3, [4, 5]) }],
| ^^^^^^^^^^^^^^^^^^^
|
note: delayed at /rustc-dev/2f1bd3f3781c90a8447e37d65a898442b8618895/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs:2536:20
0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
4: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_const_arg
5: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_ty
6: rustc_hir_analysis::collect::type_of::type_of
7: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
9: rustc_query_impl::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
10: rustc_hir_analysis::outlives::inferred_outlives_crate
11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::inferred_outlives_crate::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
13: rustc_query_impl::query_impl::inferred_outlives_crate::get_query_non_incr::__rust_end_short_backtrace
14: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::inferred_outlives_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 16]>>
15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 16]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
16: rustc_query_impl::query_impl::inferred_outlives_of::get_query_non_incr::__rust_end_short_backtrace
17: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::predicates_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 24]>>
18: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 24]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
19: rustc_query_impl::query_impl::predicates_of::get_query_non_incr::__rust_end_short_backtrace
20: rustc_hir_analysis::check::check::check_item_type
21: rustc_hir_analysis::check::wfcheck::check_well_formed
22: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
23: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
24: rustc_query_impl::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
25: rustc_hir_analysis::check::wfcheck::check_type_wf
26: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
27: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
28: rustc_query_impl::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
29: rustc_hir_analysis::check_crate
30: rustc_interface::passes::analysis
31: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
32: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
33: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
34: <rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
35: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
36: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
37: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
38: <std::sys::thread::unix::Thread>::new::thread_start
39: <unknown>
40: <unknown>
--> /tmp/icemaker_global_tempdir.UUCuQafFqrCa/rustc_testrunner_tmpdir_reporting.eDmPz001jzuy/mvce.rs:2:19
|
2 | stuff: [u8; { ([1, 2], 3, [4, 5]) }],
| ^^^^^^^^^^^^^^^^^^^
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 (2f1bd3f37 2026-01-12) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z crate-attr=feature(min_generic_const_args) -Z dump-mir-dir=dir
query stack during panic:
end of query stack
@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.