#162864·Rust

ICE expected len of array pat to be definite

Author: matthiaskrgrCreated Sep 16, 2026Updated Sep 17, 2026
LabelsI-ICEC-bugneeds-triageF-min_generic_const_args
auto-reduced (treereduce-rust): ````rust #![feature(min_generic_const_args)] #![feature(macroless_const_item_generic_const_args)] #[derive(Eq, PartialEq)] struct Data([u8; N]); const DATA: Data = Data([1, 2, 3, 4]); fn main() { match DATA { DATA | _ => {} } } ```` original: ````rust #![feature(min_generic_const_args)] #![feature(macroless_const_item_generic_const_args)] #![feature(min_adt_const_params)] use std::marker::ConstParamTy; const N: usize = todo!(); #[derive(Eq, PartialEq, ConstParamTy)] struct Data([u8; N]); const DATA: Data = Data([1, 2, 3, 4]); fn main() { match DATA { DATA | _ => {} } } ```` Version information ```` rustc 1.100.0-nightly (92801ede8 2026-09-16) binary: rustc commit-hash: 92801ede88f6c10e34df6976a4cfde40142585f2 commit-date: 2026-09-16 host: x86_64-unknown-linux-gnu release: 1.100.0-nightly LLVM version: 23.1.1 ```` Possibly related line of code: https://github.com/rust-lang/rust/blob/92801ede88f6c10e34df6976a4cfde40142585f2/compiler/rustc_pattern_analysis/src/rustc.rs#L655-L667 Command: `/home/matthias/.rustup/toolchains/master/bin/rustc ` Program output

``` error[E0425]: cannot find value `N` in this scope --> /tmp/icemaker_global_tempdir.5yEo0NROFV2x/rustc_testrunner_tmpdir_reporting.UM3VgftQGpdK/mvce.rs:5:18 | 5 | struct Data([u8; N]); | ^ not found in this scope | help: you might be missing a const parameter | 5 | struct Data([u8; N]); | +++++++++++++++++++++ error[E0425]: cannot find value `N` in this scope --> /tmp/icemaker_global_tempdir.5yEo0NROFV2x/rustc_testrunner_tmpdir_reporting.UM3VgftQGpdK/mvce.rs:5:18 | 5 | struct Data([u8; N]); | ^ not found in this scope | help: you might be missing a const parameter | 5 | struct Data([u8; N]); | +++++++++++++++++++++ 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.5yEo0NROFV2x/rustc_testrunner_tmpdir_reporting.UM3VgftQGpdK/mvce.rs:1:12 | 1 | #![feature(min_generic_const_args)] | ^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #132980 for more information = note: `#[warn(incomplete_features)]` on by default warning: the feature `macroless_const_item_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes --> /tmp/icemaker_global_tempdir.5yEo0NROFV2x/rustc_testrunner_tmpdir_reporting.UM3VgftQGpdK/mvce.rs:2:12 | 2 | #![feature(macroless_const_item_generic_const_args)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #162540 for more information error[E0741]: `Data` must implement `ConstParamTy` to be used as the type of a const generic parameter --> /tmp/icemaker_global_tempdir.5yEo0NROFV2x/rustc_testrunner_tmpdir_reporting.UM3VgftQGpdK/mvce.rs:7:13 | 7 | const DATA: Data = Data([1, 2, 3, 4]); | ^^^^ | help: add `#[derive(ConstParamTy)]` to the struct | 5 + #[derive(ConstParamTy)] 6 | struct Data([u8; N]); | thread 'rustc' (1836374) panicked at /rustc-dev/92801ede88f6c10e34df6976a4cfde40142585f2/compiler/rustc_pattern_analysis/src/rustc.rs:661:30: expected len of array pat to be definite stack backtrace: 0: 0x7f4202681956 - <::print::DisplayBacktrace as core[bf8227dabe305445]::fmt::Display>::fmt 1: 0x7f4202e09cd1 - core[bf8227dabe305445]::fmt::write 2: 0x7f420269691c - ::write_fmt 3: 0x7f420265445a - std[720dee8f8bfdc813]::panicking::default_hook::{closure#0} 4: 0x7f4202675f03 - std[720dee8f8bfdc813]::panicking::default_hook 5: 0x7f420138509f - std[720dee8f8bfdc813]::panicking::update_hook::>::{closure#0} 6: 0x7f42026763a2 - std[720dee8f8bfdc813]::panicking::panic_with_hook 7: 0x7f4202654512 - std[720dee8f8bfdc813]::panicking::panic_handler::{closure#0} 8: 0x7f420264b339 - std[720dee8f8bfdc813]::sys::backtrace::__rust_end_short_backtrace:: 9: 0x7f42026560ed - __rustc[ea5107eac9713e7a]::rust_begin_unwind 10: 0x7f41ff106c3c - core[bf8227dabe305445]::panicking::panic_fmt 11: 0x7f420002e804 - core[bf8227dabe305445]::option::expect_failed 12: 0x7f41ff8a7a81 - ::lower_pat 13: 0x7f41ff8a6b7b - ::lower_pat 14: 0x7f41ff8a712d - ::lower_pat 15: 0x7f4203fa0ddd - ::check_match 16: 0x7f4202e0d714 - ::visit_expr 17: 0x7f4202e0d2ec - ::visit_expr 18: 0x7f4202e0d341 - ::visit_expr 19: 0x7f4202e0d2ec - ::visit_expr 20: 0x7f42034af1a5 - rustc_mir_build[52c1d15651296a42]::thir::pattern::check_match::check_match 21: 0x7f42034aeddb - rustc_query_impl[fa11e8f5231da85c]::query_vtables::check_match::invoke_provider_fn::__rust_begin_short_backtrace 22: 0x7f4203bad861 - rustc_query_impl[fa11e8f5231da85c]::execution::try_execute_query::, rustc_middle[249b3c20e033e7b6]::dep_graph::graph::DepNodeIndex>, false> 23: 0x7f4203bad5d5 - rustc_query_impl[fa11e8f5231da85c]::query_vtables::check_match::execute_query_non_incr::__rust_end_short_backtrace 24: 0x7f4203777a1f - rustc_mir_build[52c1d15651296a42]::builder::build_mir_inner_impl 25: 0x7f4202e2432a - rustc_mir_transform[43fbec4f37f8ce5b]::mir_built 26: 0x7f42034b3f75 - rustc_query_impl[fa11e8f5231da85c]::execution::try_execute_query::, rustc_middle[249b3c20e033e7b6]::dep_graph::graph::DepNodeIndex>, false> 27: 0x7f42034b3c67 - rustc_query_impl[fa11e8f5231da85c]::query_vtables::mir_built::execute_query_non_incr::__rust_end_short_backtrace 28: 0x7f42034a1b86 - rustc_mir_build[52c1d15651296a42]::check_unsafety::check_unsafety 29: 0x7f42034b7b1e - rustc_query_impl[fa11e8f5231da85c]::execution::try_execute_query::, rustc_middle[249b3c20e033e7b6]::dep_graph::graph::DepNodeIndex>, false> 30: 0x7f42034b7895 - rustc_query_impl[fa11e8f5231da85c]::query_vtables::check_unsafety::execute_query_non_incr::__rust_end_short_backtrace 31: 0x7f42034b6693 - ::par_hir_body_owners::::{closure#0} 32: 0x7f42034b5a94 - rustc_interface[758637dfb6969226]::passes::analysis 33: 0x7f42040029ca - rustc_query_impl[fa11e8f5231da85c]::execution::try_execute_query::>, false> 34: 0x7f42040027ab - rustc_query_impl[fa11e8f5231da85c]::query_vtables::analysis::execute_query_non_incr::__rust_end_short_backtrace 35: 0x7f42040f93af - rustc_interface[758637dfb6969226]::interface::run_compiler::<(), rustc_driver_impl[249e893f59edbaf7]::run_compiler::{closure#0}>::{closure#2} 36: 0x7f4204171402 - std[720dee8f8bfdc813]::sys::backtrace::__rust_begin_short_backtrace::::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> 37: 0x7f42041711ad - ::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[bf8227dabe305445]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 38: 0x7f420417bee1 - ::new::thread_start 39: 0x7f41fce980a2 - 40: 0x7f41fcf2080c - 41: 0x0 - 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.100.0-nightly (92801ede8 2026-09-16) running on x86_64-unknown-linux-gnu query stack during panic: #0 [check_match] match-checking `main` #1 [mir_built] building MIR for `main` #2 [check_unsafety] unsafety-checking `main` #3 [analysis] running analysis passes on crate `mvce` end of query stack error: aborting due to 3 previous errors; 2 warnings emitted Some errors have detailed explanations: E0425, E0741. For more information about an error, try `rustc --explain E0425`. ```

@rustbot label +F-min_generic_const_args +F-min_adt_const_params