Skip to content

ICE: unsupported const array #151054

@reddevilmidzy

Description

@reddevilmidzy

Code

#![feature(min_generic_const_args)]

struct Foo {
    val: [u8; { [1] }],
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.94.0-nightly (2f1bd3f37 2026-01-12)
binary: rustc
commit-hash: 2f1bd3f3781c90a8447e37d65a898442b8618895
commit-date: 2026-01-12
host: x86_64-pc-windows-msvc
release: 1.94.0-nightly
LLVM version: 21.1.8

Error output

warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
 --> src\main.rs: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
 --> src\main.rs:4:15
  |
4 |     val: [u8; { [1] }],
  |               ^^   ^^
  |
  = note: `#[warn(unused_braces)]` (part of `#[warn(unused)]`) on by default
help: remove these braces
  |
4 -     val: [u8; { [1] }],
4 +     val: [u8; [1]],
  |

warning: struct `Foo` is never constructed
 --> src\main.rs:3:8
  |
3 | struct Foo {
  |        ^^^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors
Backtrace

error: internal compiler error: unsupported const array
 --> src\main.rs:4:17
  |
4 |     val: [u8; { [1] }],
  |                 ^^^
  |
note: delayed at /rustc-dev/2f1bd3f3781c90a8447e37d65a898442b8618895/compiler\rustc_hir_analysis\src\hir_ty_lowering\mod.rs:2414:20
         0: std::backtrace_rs::backtrace::win64::trace
                   at /rustc/2f1bd3f3781c90a8447e37d65a898442b8618895/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
         1: std::backtrace_rs::backtrace::trace_unsynchronized
                   at /rustc/2f1bd3f3781c90a8447e37d65a898442b8618895/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
         2: std::backtrace::Backtrace::create
                   at /rustc/2f1bd3f3781c90a8447e37d65a898442b8618895/library\std\src\backtrace.rs:331
         3: std::backtrace::Backtrace::capture
                   at /rustc/2f1bd3f3781c90a8447e37d65a898442b8618895/library\std\src\backtrace.rs:296
         4: <rustc_errors::DiagCtxtHandle>::has_errors_excluding_lint_errors
         5: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
         6: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         7: <hashbrown::raw::RawTable<usize>>::reserve_rehash::<indexmap::map::core::get_hash<(rustc_middle::ty::region::Region, usize), ()>::{closure#0}>
         8: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_const_arg
         9: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_ty
        10: rustc_hir_analysis::check::check::check_abi
        11: RINvMs6_NtCsaC50LK3p28O_9hashbrown3rawINtB6_8RawTableTTNtNtNtCsk6fnBi1TQ6L_12rustc_middle2ty8instance8InstanceNtNtNtBX_3mir4mono14CollectionModeETINtNtNtBX_5query5erase6ErasedAhj20_ENtNtNtCs3Q5j20q2q4d_18rustc_query_system9dep_graph5graph12DepNodeIndexEEE1
        12: RINvNtNtCs3Q5j20q2q4d_18rustc_query_system5query8plumbing17try_execute_queryINtCsaeXrSaoPnXt_16rustc_query_impl13DynamicConfigINtNtB4_6caches10DefIdCacheINtNtNtCsk6fnBi1TQ6L_12rustc_middle5query5erase6ErasedAhj8_EEKb0_KB3r_KB3r_ENtNtB1f_8plumbing9QueryCtxt
        13: rustc_query_impl::plumbing::query_key_hash_verify_all
        14: <rustc_hir_analysis::autoderef::Autoderef>::new
        15: <rustc_lint::builtin::SpecialModuleName as rustc_lint::passes::EarlyLintPass>::check_crate
        16: RINvNtNtCs3Q5j20q2q4d_18rustc_query_system5query8plumbing17try_execute_queryINtCsaeXrSaoPnXt_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCsk6fnBi1TQ6L_12rustc_middle5query5erase6ErasedAhj8_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
        17: <alloc::sync::Arc<rustc_session::cstore::CrateSource>>::drop_slow
        18: <rustc_hir_analysis::autoderef::Autoderef>::new
        19: RINvMs6_NtCsaC50LK3p28O_9hashbrown3rawINtB6_8RawTableTTNtNtNtCsk6fnBi1TQ6L_12rustc_middle2ty8instance8InstanceNtNtNtBX_3mir4mono14CollectionModeETINtNtNtBX_5query5erase6ErasedAhj20_ENtNtNtCs3Q5j20q2q4d_18rustc_query_system9dep_graph5graph12DepNodeIndexEEE1
        20: RINvNtNtCs3Q5j20q2q4d_18rustc_query_system5query8plumbing17try_execute_queryINtCsaeXrSaoPnXt_16rustc_query_impl13DynamicConfigINtNtB4_6caches10DefIdCacheINtNtNtCsk6fnBi1TQ6L_12rustc_middle5query5erase6ErasedAhj10_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
        21: rustc_query_impl::plumbing::query_key_hash_verify_all
        22: rustc_hir_analysis::check::check::check_abi
        23: RINvMs6_NtCsaC50LK3p28O_9hashbrown3rawINtB6_8RawTableTTNtNtNtCsk6fnBi1TQ6L_12rustc_middle2ty8instance8InstanceNtNtNtBX_3mir4mono14CollectionModeETINtNtNtBX_5query5erase6ErasedAhj20_ENtNtNtCs3Q5j20q2q4d_18rustc_query_system9dep_graph5graph12DepNodeIndexEEE1
        24: RINvNtNtCs3Q5j20q2q4d_18rustc_query_system5query8plumbing17try_execute_queryINtCsaeXrSaoPnXt_16rustc_query_impl13DynamicConfigINtNtB4_6caches10DefIdCacheINtNtNtCsk6fnBi1TQ6L_12rustc_middle5query5erase6ErasedAhj18_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
        25: rustc_query_impl::plumbing::query_key_hash_verify_all
        26: rustc_hir_analysis::hir_ty_lowering::generics::check_generic_arg_count_for_call
        27: rustc_hir_analysis::check::check::check_abi
        28: RINvMs6_NtCsaC50LK3p28O_9hashbrown3rawINtB6_8RawTableTTNtNtNtCsk6fnBi1TQ6L_12rustc_middle2ty8instance8InstanceNtNtNtBX_3mir4mono14CollectionModeETINtNtNtBX_5query5erase6ErasedAhj20_ENtNtNtCs3Q5j20q2q4d_18rustc_query_system9dep_graph5graph12DepNodeIndexEEE1
        29: RINvNtNtCs3Q5j20q2q4d_18rustc_query_system5query8plumbing17try_execute_queryINtCsaeXrSaoPnXt_16rustc_query_impl13DynamicConfigINtNtCsgpRijU9JXYR_21rustc_data_structures9vec_cache8VecCacheNtNtCs1UDKO9npTkW_10rustc_span6def_id10LocalDefIdINtNtNtCsk6fnBi1TQ6L
        30: rustc_query_impl::plumbing::query_key_hash_verify_all
        31: rustc_hir_analysis::check::check::check_abi
        32: <rustc_lint::builtin::SpecialModuleName as rustc_lint::passes::EarlyLintPass>::check_crate
        33: RINvNtNtCs3Q5j20q2q4d_18rustc_query_system5query8plumbing17try_execute_queryINtCsaeXrSaoPnXt_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCsk6fnBi1TQ6L_12rustc_middle5query5erase6ErasedAhj1_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
        34: rustc_query_impl::profiling_support::alloc_self_profile_query_strings
        35: rustc_hir_analysis::check_crate
        36: rustc_interface::passes::analysis
        37: <rustc_lint::builtin::SpecialModuleName as rustc_lint::passes::EarlyLintPass>::check_crate
        38: RINvNtNtCs3Q5j20q2q4d_18rustc_query_system5query8plumbing17try_execute_queryINtCsaeXrSaoPnXt_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCsk6fnBi1TQ6L_12rustc_middle5query5erase6ErasedAhj0_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
        39: rustc_query_impl::profiling_support::alloc_self_profile_query_strings
        40: std::sys::backtrace::__rust_begin_short_backtrace::<std::thread::lifecycle::spawn_unchecked<ctrlc::set_handler_inner<rustc_driver_impl::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
        41: RINvNtNtCs8e0MUBgvcr4_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCs9ucZVsSChZw_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCs8U0dS8raFDC_17rustc_driver_i
        42: std::sys::backtrace::__rust_begin_short_backtrace::<std::thread::lifecycle::spawn_unchecked<ctrlc::set_handler_inner<rustc_driver_impl::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
        43: std::sys::thread::windows::impl$0::new::thread_start
                   at /rustc/2f1bd3f3781c90a8447e37d65a898442b8618895/library\std\src\sys\thread\windows.rs:58
        44: BaseThreadInitThunk
        45: RtlUserThreadStart

 --> src\main.rs:4:17
  |
4 |     val: [u8; { [1] }],
  |                 ^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-min_generic_const_args`#![feature(min_generic_const_args)]`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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions