Skip to content

ICE:normalizing free const aliases in the type system is unsupported #140729

Open
@sososopy

Description

@sososopy

Code

#![feature(adt_const_params)]
#![feature(min_generic_const_args)]

const C: [[usize; 512]; 512];
pub struct A<const M: [[usize; 512]; 512]> {
}
impl A<C> {
    fn fun1() -> &'static str {}
}
impl A{
    fn fun1() -> &'static str {}
}

Meta

rustc --version --verbose:

rustc 1.88.0-nightly (27d6200a7 2025-05-06)
binary: rustc
commit-hash: 27d6200a70601f6fcf419bf2f9e37989f3624ca4
commit-date: 2025-05-06
host: x86_64-pc-windows-msvc
release: 1.88.0-nightly
LLVM version: 20.1.4

Error output

error: free constant item without body
    |
294 | const C: [[usize; 512]; 512];
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
    |                             |
    |                             help: provide a definition for the constant: `= <expr>;`
error[E0601]: `main` function not found in crate `test`
    |
302 | }
    |  ^ consider adding a `main` function`

error[E0107]: missing generics for struct `A`
    |
300 | impl A{
    |      ^ expected 1 generic argument
    |
note: struct defined here, with 1 generic parameter: `M`
    |
295 | pub struct A<const M: [[usize; 512]; 512]> {
    |            ^ ----------------------------
help: add missing generic argument
    |
300 | impl A<M>{
Backtrace

thread 'rustc' panicked at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4\compiler\rustc_next_trait_solver\src\solve\normalizes_to\free_alias.rs:37:13:
normalizing free const aliases in the type system is unsupported
stack backtrace:
   0:     0x7ffd6f8fb8f2 - std::backtrace_rs::backtrace::win64::trace
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
   1:     0x7ffd6f8fb8f2 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffd6f8fb8f2 - std::sys::backtrace::_print_fmt
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\std\src\sys\backtrace.rs:66
   3:     0x7ffd6f8fb8f2 - std::sys::backtrace::impl$0::print::impl$0::fmt
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\std\src\sys\backtrace.rs:39
   4:     0x7ffd6f92e0bb - core::fmt::rt::Argument::fmt
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\core\src\fmt\rt.rs:181
   5:     0x7ffd6f92e0bb - core::fmt::write
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\core\src\fmt\mod.rs:1446
   6:     0x7ffd6f8f18c7 - std::io::default_write_fmt
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\std\src\io\mod.rs:639
   7:     0x7ffd6f8f18c7 - std::io::Write::write_fmt<std::sys::stdio::windows::Stderr>
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\std\src\io\mod.rs:1914
   8:     0x7ffd6f8fb735 - std::sys::backtrace::BacktraceLock::print
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\std\src\sys\backtrace.rs:42
   9:     0x7ffd6f90138a - std::panicking::default_hook::closure$0
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\std\src\panicking.rs:300
  10:     0x7ffd6f901120 - std::panicking::default_hook
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\std\src\panicking.rs:327
  11:     0x7ffd71010639 - core[f3ba7138fd57ba46]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[c47315345f7933c0]::Level, &str), usize), <((rustc_lint_defs[c47315345f7933c0]::Level, &str), usize) as core[f3ba7138fd57ba46]::cmp::PartialOrd>::lt>
  12:     0x7ffd6f90201e - std::panicking::rust_panic_with_hook
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\std\src\panicking.rs:841
  13:     0x7ffd6f901d42 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\std\src\panicking.rs:699
  14:     0x7ffd6f8fc6af - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\std\src\sys\backtrace.rs:168
  15:     0x7ffd6f90197e - std::panicking::begin_panic_handler
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\std\src\panicking.rs:697
  16:     0x7ffd72a78e01 - core::panicking::panic_fmt
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\core\src\panicking.rs:75
  17:     0x7ffd6f53e7a0 - rustc_codegen_ssa[b8af61421ef834af]::debuginfo::type_names::compute_debuginfo_vtable_name
  18:     0x7ffd6f52034b - rustc_codegen_ssa[b8af61421ef834af]::debuginfo::type_names::compute_debuginfo_vtable_name
  19:     0x7ffd6f545af6 - <alloc[ea825cf2ae0fac8d]::raw_vec::RawVec<rustc_trait_selection[d61a5f081a35f129]::solve::inspect::analyse::InspectCandidate>>::grow_one
  20:     0x7ffd6f548669 - <alloc[ea825cf2ae0fac8d]::raw_vec::RawVec<rustc_trait_selection[d61a5f081a35f129]::solve::inspect::analyse::InspectCandidate>>::grow_one
  21:     0x7ffd6f539df8 - rustc_codegen_ssa[b8af61421ef834af]::debuginfo::type_names::compute_debuginfo_vtable_name
  22:     0x7ffd6f52034b - rustc_codegen_ssa[b8af61421ef834af]::debuginfo::type_names::compute_debuginfo_vtable_name
  23:     0x7ffd6f545af6 - <alloc[ea825cf2ae0fac8d]::raw_vec::RawVec<rustc_trait_selection[d61a5f081a35f129]::solve::inspect::analyse::InspectCandidate>>::grow_one
  24:     0x7ffd6f58b5dd - rustc_trait_selection[d61a5f081a35f129]::traits::coherence::overlapping_impls
  25:     0x7ffd6f58a4a1 - rustc_trait_selection[d61a5f081a35f129]::traits::coherence::overlapping_impls
  26:     0x7ffd6f1378cc - rustc_hir_analysis[8932559348a889e3]::check::check_function_signature
  27:     0x7ffd6fc4b9ed - <rustc_hir_analysis[8932559348a889e3]::autoderef::Autoderef>::into_obligations
  28:     0x7ffd6f47c88b - <alloc[ea825cf2ae0fac8d]::sync::Arc<rustc_session[af420db3a1ddf9d5]::cstore::CrateSource>>::drop_slow
  29:     0x7ffd6f389bfa - RINvNtNtCs74TgHxZLeff_18rustc_query_system5query8plumbing17try_execute_queryINtCs4ZGfxhMUaYB_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCsd1QdgvaAdwy_12rustc_middle5query5erase6ErasedAhj1_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
  30:     0x7ffd6f48f183 - rustc_query_impl[3a2da1cfd4e380b7]::query_system
  31:     0x7ffd6fc8be75 - rustc_hir_analysis[8932559348a889e3]::check_crate
  32:     0x7ffd6f9656f3 - <rustc_interface[de93994d21f55fb9]::passes::LintStoreExpandImpl as rustc_expand[c0fe915ae76c77fa]::base::LintStoreExpand>::pre_expansion_lint
  33:     0x7ffd6c26d6a7 - rustc_interface[de93994d21f55fb9]::passes::analysis
  34:     0x7ffd6f47cc1a - <alloc[ea825cf2ae0fac8d]::sync::Arc<rustc_session[af420db3a1ddf9d5]::cstore::CrateSource>>::drop_slow
  35:     0x7ffd6f3857fa - RINvNtNtCs74TgHxZLeff_18rustc_query_system5query8plumbing17try_execute_queryINtCs4ZGfxhMUaYB_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCsd1QdgvaAdwy_12rustc_middle5query5erase6ErasedAhj0_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
  36:     0x7ffd6f483243 - rustc_query_impl[3a2da1cfd4e380b7]::query_system
  37:     0x7ffd6c22ecb5 - std[b9536bce84c2e315]::sys::backtrace::__rust_begin_short_backtrace::<<std[b9536bce84c2e315]::thread::Builder>::spawn_unchecked_<ctrlc[b16cc6ccfb573262]::set_handler_inner<rustc_driver_impl[35a33f1ecc58a238]::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
  38:     0x7ffd6c228f13 - std[b9536bce84c2e315]::sys::backtrace::__rust_begin_short_backtrace::<<std[b9536bce84c2e315]::thread::Builder>::spawn_unchecked_<ctrlc[b16cc6ccfb573262]::set_handler_inner<rustc_driver_impl[35a33f1ecc58a238]::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
  39:     0x7ffd6c22479f - RINvNtNtCsfUu5ctRylQ7_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCsj6LJ5K1g9kH_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCs4BvKB23zGPs_17rustc_driver_i
  40:     0x7ffd6c233010 - std[b9536bce84c2e315]::sys::backtrace::__rust_begin_short_backtrace::<<std[b9536bce84c2e315]::thread::Builder>::spawn_unchecked_<ctrlc[b16cc6ccfb573262]::set_handler_inner<rustc_driver_impl[35a33f1ecc58a238]::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
  41:     0x7ffd6f90638d - alloc::boxed::impl$28::call_once
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\alloc\src\boxed.rs:1966
  42:     0x7ffd6f90638d - alloc::boxed::impl$28::call_once
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\alloc\src\boxed.rs:1966
  43:     0x7ffd6f90638d - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/27d6200a70601f6fcf419bf2f9e37989f3624ca4/library\std\src\sys\pal\windows\thread.rs:56
  44:     0x7ffe4b087374 - BaseThreadInitThunk
  45:     0x7ffe4d09cc91 - RtlUserThreadStart

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

query stack during panic:
#0 [crate_inherent_impls_overlap_check] check for overlap between inherent impls defined in this crate
#1 [analysis] running analysis passes on this crate
end of query stack

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) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.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