Open
Description
auto-reduced (treereduce-rust):
#![feature(generic_const_exprs)]
fn is_123<const N: usize>(
x: [u32; {
N + 1;
5
}],
) -> bool {
match x {
[1, 2] => true,
_ => false,
}
}
original:
fn is_123<const N: usize>(x: [u32; { N + 1; 5 }]) -> bool {
match x {
[1, 2] => true, //~ ERROR mismatched types
_ => false
}
}
fn main() {}
Version information
rustc 1.88.0-nightly (c580c498a 2025-04-14)
binary: rustc
commit-hash: c580c498a1fe144d7c5b2dfc7faab1a229aa288b
commit-date: 2025-04-14
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.2
Possibly related line of code:
rust/compiler/rustc_mir_build/src/builder/matches/match_pair.rs
Lines 43 to 55 in c580c49
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(generic_const_exprs)
Program output
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
--> <crate attribute>: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
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.fj15fX8ubODB/rustc_testrunner_tmpdir_reporting.s7AyRYc5iQ5Z/mvce.rs:11:2
|
11 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.fj15fX8ubODB/rustc_testrunner_tmpdir_reporting.s7AyRYc5iQ5Z/mvce.rs`
error: overly complex generic constant
--> /tmp/icemaker_global_tempdir.fj15fX8ubODB/rustc_testrunner_tmpdir_reporting.s7AyRYc5iQ5Z/mvce.rs:2:14
|
2 | x: [u32; {
| ______________^
3 | | N + 1;
4 | | 5
5 | | }],
| |_____^ blocks are not supported in generic constants
|
= help: consider moving this anonymous constant into a `const` function
= note: this operation may be supported in the future
thread 'rustc' panicked at compiler/rustc_mir_build/src/builder/matches/match_pair.rs:49:26:
expected len of array pat to be definite
stack backtrace:
0: 0x76a70d8f5803 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::he137faf1a18df1db
1: 0x76a70e006051 - core::fmt::write::h91755fbfaddf7ffb
2: 0x76a70f4ae011 - std::io::Write::write_fmt::hc96efb08aa08a02e
3: 0x76a70d8f5662 - std::sys::backtrace::BacktraceLock::print::ha70abd97698330ed
4: 0x76a70d8f914a - std::panicking::default_hook::{{closure}}::h8caf203b8fc4b95a
5: 0x76a70d8f8ccf - std::panicking::default_hook::h18654ff1fe4ed24b
6: 0x76a70c963603 - std[8cc451807e0e7beb]::panicking::update_hook::<alloc[73f72a203e12369d]::boxed::Box<rustc_driver_impl[c4ad34755bb049a3]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x76a70d8f99c3 - std::panicking::rust_panic_with_hook::h76d5e98d413ceeff
8: 0x76a70d8f96ba - std::panicking::begin_panic_handler::{{closure}}::hb0a99bab0ad16d13
9: 0x76a70d8f5cc9 - std::sys::backtrace::__rust_end_short_backtrace::h5393ec4087a5e093
10: 0x76a70d8f937d - __rustc[b1dbf4b513c8357d]::rust_begin_unwind
11: 0x76a70a28acc0 - core::panicking::panic_fmt::h7c4cd96a8d4dc575
12: 0x76a70b18277b - core::option::expect_failed::h66a4d167aeb7206d
13: 0x76a70fb5dc8e - <rustc_mir_build[c533163d3a765291]::builder::Builder>::prefix_slice_suffix.cold
14: 0x76a70eb7f712 - <rustc_mir_build[c533163d3a765291]::builder::matches::MatchPairTree>::for_pattern
15: 0x76a70eb7ac30 - <rustc_mir_build[c533163d3a765291]::builder::Builder>::lower_match_tree
16: 0x76a70e410cf8 - <rustc_mir_build[c533163d3a765291]::builder::Builder>::expr_into_dest
17: 0x76a70e412019 - <rustc_mir_build[c533163d3a765291]::builder::Builder>::expr_into_dest
18: 0x76a70ed8ecf7 - <rustc_mir_build[c533163d3a765291]::builder::Builder>::ast_block_stmts
19: 0x76a70ed8d80c - <rustc_mir_build[c533163d3a765291]::builder::Builder>::ast_block
20: 0x76a70e40fa84 - <rustc_mir_build[c533163d3a765291]::builder::Builder>::expr_into_dest
21: 0x76a70e412019 - <rustc_mir_build[c533163d3a765291]::builder::Builder>::expr_into_dest
22: 0x76a70e3dad86 - rustc_mir_build[c533163d3a765291]::builder::build_mir
23: 0x76a70e00a0c5 - rustc_mir_transform[a20fd6afc3bb3ae5]::mir_built
24: 0x76a70e00a097 - rustc_query_impl[994d8d0f232e6f76]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[994d8d0f232e6f76]::query_impl::mir_built::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cdeaf14df3177256]::query::erase::Erased<[u8; 8usize]>>
25: 0x76a70e25c22c - rustc_query_system[fdd22cd2b18f3d20]::query::plumbing::try_execute_query::<rustc_query_impl[994d8d0f232e6f76]::DynamicConfig<rustc_data_structures[bb20cc737854270d]::vec_cache::VecCache<rustc_span[d423fa63ad2163fb]::def_id::LocalDefId, rustc_middle[cdeaf14df3177256]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[fdd22cd2b18f3d20]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[994d8d0f232e6f76]::plumbing::QueryCtxt, false>
26: 0x76a70e25bd4b - rustc_query_impl[994d8d0f232e6f76]::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace
27: 0x76a70e9759c3 - rustc_mir_build[c533163d3a765291]::check_unsafety::check_unsafety
28: 0x76a70e975799 - rustc_query_impl[994d8d0f232e6f76]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[994d8d0f232e6f76]::query_impl::check_unsafety::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cdeaf14df3177256]::query::erase::Erased<[u8; 0usize]>>
29: 0x76a70e974d9d - rustc_query_system[fdd22cd2b18f3d20]::query::plumbing::try_execute_query::<rustc_query_impl[994d8d0f232e6f76]::DynamicConfig<rustc_data_structures[bb20cc737854270d]::vec_cache::VecCache<rustc_span[d423fa63ad2163fb]::def_id::LocalDefId, rustc_middle[cdeaf14df3177256]::query::erase::Erased<[u8; 0usize]>, rustc_query_system[fdd22cd2b18f3d20]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[994d8d0f232e6f76]::plumbing::QueryCtxt, false>
30: 0x76a70e974a7e - rustc_query_impl[994d8d0f232e6f76]::query_impl::check_unsafety::get_query_non_incr::__rust_end_short_backtrace
31: 0x76a70e97139d - rustc_interface[89d8dc017f235532]::passes::run_required_analyses
32: 0x76a70ef46d1e - rustc_interface[89d8dc017f235532]::passes::analysis
33: 0x76a70ef46ced - rustc_query_impl[994d8d0f232e6f76]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[994d8d0f232e6f76]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cdeaf14df3177256]::query::erase::Erased<[u8; 0usize]>>
34: 0x76a70ef4c7bd - rustc_query_system[fdd22cd2b18f3d20]::query::plumbing::try_execute_query::<rustc_query_impl[994d8d0f232e6f76]::DynamicConfig<rustc_query_system[fdd22cd2b18f3d20]::query::caches::SingleCache<rustc_middle[cdeaf14df3177256]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[994d8d0f232e6f76]::plumbing::QueryCtxt, false>
35: 0x76a70ef4c4b8 - rustc_query_impl[994d8d0f232e6f76]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
36: 0x76a70f33ccbe - rustc_interface[89d8dc017f235532]::passes::create_and_enter_global_ctxt::<core[9797c9d635bbf607]::option::Option<rustc_interface[89d8dc017f235532]::queries::Linker>, rustc_driver_impl[c4ad34755bb049a3]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
37: 0x76a70f13ddc4 - rustc_interface[89d8dc017f235532]::interface::run_compiler::<(), rustc_driver_impl[c4ad34755bb049a3]::run_compiler::{closure#0}>::{closure#1}
38: 0x76a70f1633b2 - std[8cc451807e0e7beb]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[89d8dc017f235532]::util::run_in_thread_with_globals<rustc_interface[89d8dc017f235532]::util::run_in_thread_pool_with_globals<rustc_interface[89d8dc017f235532]::interface::run_compiler<(), rustc_driver_impl[c4ad34755bb049a3]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
39: 0x76a70f163cab - <<std[8cc451807e0e7beb]::thread::Builder>::spawn_unchecked_<rustc_interface[89d8dc017f235532]::util::run_in_thread_with_globals<rustc_interface[89d8dc017f235532]::util::run_in_thread_pool_with_globals<rustc_interface[89d8dc017f235532]::interface::run_compiler<(), rustc_driver_impl[c4ad34755bb049a3]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[9797c9d635bbf607]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
40: 0x76a70f1650ab - std::sys::pal::unix::thread::Thread::new::thread_start::heb5f87066979571c
41: 0x76a708ea370a - <unknown>
42: 0x76a708f27aac - <unknown>
43: 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.88.0-nightly (c580c498a 2025-04-14) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z crate-attr=feature(generic_const_exprs) -Z dump-mir-dir=dir
query stack during panic:
#0 [mir_built] building MIR for `is_123`
#1 [check_unsafety] unsafety-checking `is_123`
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0601`.
@rustbot label +F-generic_const_exprs