Skip to content

ICE: normalizing inherent associated consts in the type system is unsupported #142722

Open
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

#![feature(min_generic_const_args)]
#![feature(inherent_associated_types)]
struct Foo<const H: usize> {}

impl Foo<Concat> {
    const ASSOC_C: usize = 3;

    fn foo()
    where
        [u8; Self::ASSOC_C]:,
    {
    }
}

original:

//@ edition:2018
//@ check-pass


const SIZE: usize = 16;

struct Bar<const A: usize> {}

struct Foo<const H: usize> {}

impl<const Some: usize> Foo<Concat> {
    const ASSOC_C: usize = 3;

    fn foo()
    where
        [u8; Self::ASSOC_C]:,
    {
        let _: [u8; Self::ASSOC_C] = loop {};
    }
}

fn SIZE() { }

Version information

rustc 1.89.0-nightly (8a65ee082 2025-06-19)
binary: rustc
commit-hash: 8a65ee08296b36342bf7c3cdc15312ccbc357227
commit-date: 2025-06-19
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.7

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(min_generic_const_args) -Zcrate-attr=feature(inherent_associated_types)

Program output

error[E0412]: cannot find type `Concat` in this scope
 --> /tmp/icemaker_global_tempdir.qSyg1Em1SDMq/rustc_testrunner_tmpdir_reporting.eyZ7FFhpmB5o/mvce.rs:3:10
  |
3 | impl Foo<Concat> {
  |          ^^^^^^ not found in this scope
  |
help: consider importing this trait
  |
1 + use std::slice::Concat;
  |

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: the feature `inherent_associated_types` is incomplete and may not be safe to use and/or cause compiler crashes
 --> <crate attribute>:1:12
  |
1 | #![feature(inherent_associated_types)]
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.qSyg1Em1SDMq/rustc_testrunner_tmpdir_reporting.eyZ7FFhpmB5o/mvce.rs:11:2
   |
11 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.qSyg1Em1SDMq/rustc_testrunner_tmpdir_reporting.eyZ7FFhpmB5o/mvce.rs`

error[E0747]: unresolved item provided when a constant was expected
 --> /tmp/icemaker_global_tempdir.qSyg1Em1SDMq/rustc_testrunner_tmpdir_reporting.eyZ7FFhpmB5o/mvce.rs:3:10
  |
3 | impl Foo<Concat> {
  |          ^^^^^^
  |
help: if this generic argument was intended as a const parameter, surround it with braces
  |
3 | impl Foo<{ Concat }> {
  |          +        +


thread 'rustc' panicked at /rustc-dev/8a65ee08296b36342bf7c3cdc15312ccbc357227/compiler/rustc_next_trait_solver/src/solve/normalizes_to/inherent.rs:58:13:
normalizing inherent associated consts in the type system is unsupported
stack backtrace:
   0:     0x7132e08e7d63 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hddb5e99560778aed
   1:     0x7132e1002c7f - core::fmt::write::h12c234f0edc7b706
   2:     0x7132e08dd8e3 - std::io::Write::write_fmt::h1c65d113e08eaaff
   3:     0x7132e08e7bc2 - std::sys::backtrace::BacktraceLock::print::h9652e925cb317248
   4:     0x7132e08eb6ba - std::panicking::default_hook::{{closure}}::h58c1e754bf819be3
   5:     0x7132e08eb23f - std::panicking::default_hook::hc5c32bd16ea0a105
   6:     0x7132df9decc7 - std[cbbb60a5cfd7ff5b]::panicking::update_hook::<alloc[e39721c0a904e78d]::boxed::Box<rustc_driver_impl[8279e16dc5823618]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7132e08ebf13 - std::panicking::rust_panic_with_hook::h87286a060ae3c579
   8:     0x7132e08ebbd6 - std::panicking::begin_panic_handler::{{closure}}::h9993a424c66ef4f5
   9:     0x7132e08e8229 - std::sys::backtrace::__rust_end_short_backtrace::h56462a577ae5bd16
  10:     0x7132e08eb8ed - __rustc[f6fea210adcf08ea]::rust_begin_unwind
  11:     0x7132dd0918c0 - core::panicking::panic_fmt::hd1b0d938cad2ab35
  12:     0x7132e1d7b735 - <rustc_type_ir[f425777cba5ad9d]::search_graph::SearchGraph<rustc_next_trait_solver[9fb1a2958be2686b]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[afbea2bae8dda0a8]::solve::delegate::SolverDelegate>, rustc_middle[93a0193236758a7b]::ty::context::TyCtxt>>::with_new_goal::<<rustc_next_trait_solver[9fb1a2958be2686b]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[afbea2bae8dda0a8]::solve::delegate::SolverDelegate, rustc_middle[93a0193236758a7b]::ty::context::TyCtxt>>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>::{closure#2}
  13:     0x7132e1d88504 - <rustc_next_trait_solver[9fb1a2958be2686b]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[afbea2bae8dda0a8]::solve::delegate::SolverDelegate, rustc_middle[93a0193236758a7b]::ty::context::TyCtxt>>::evaluate_goal_raw
  14:     0x7132e1d84e20 - <rustc_next_trait_solver[9fb1a2958be2686b]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[afbea2bae8dda0a8]::solve::delegate::SolverDelegate, rustc_middle[93a0193236758a7b]::ty::context::TyCtxt>>::evaluate_added_goals_step
  15:     0x7132e1d798b6 - <rustc_type_ir[f425777cba5ad9d]::search_graph::SearchGraph<rustc_next_trait_solver[9fb1a2958be2686b]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[afbea2bae8dda0a8]::solve::delegate::SolverDelegate>, rustc_middle[93a0193236758a7b]::ty::context::TyCtxt>>::with_new_goal::<<rustc_next_trait_solver[9fb1a2958be2686b]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[afbea2bae8dda0a8]::solve::delegate::SolverDelegate, rustc_middle[93a0193236758a7b]::ty::context::TyCtxt>>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>::{closure#2}
  16:     0x7132e1d88504 - <rustc_next_trait_solver[9fb1a2958be2686b]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[afbea2bae8dda0a8]::solve::delegate::SolverDelegate, rustc_middle[93a0193236758a7b]::ty::context::TyCtxt>>::evaluate_goal_raw
  17:     0x7132e1d84a80 - <rustc_next_trait_solver[9fb1a2958be2686b]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[afbea2bae8dda0a8]::solve::delegate::SolverDelegate, rustc_middle[93a0193236758a7b]::ty::context::TyCtxt>>::evaluate_added_goals_step
  18:     0x7132e1d668c5 - <rustc_next_trait_solver[9fb1a2958be2686b]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[afbea2bae8dda0a8]::solve::delegate::SolverDelegate, rustc_middle[93a0193236758a7b]::ty::context::TyCtxt>>::evaluate_added_goals_and_make_canonical_response::{closure#0}
  19:     0x7132e1d793fc - <rustc_type_ir[f425777cba5ad9d]::search_graph::SearchGraph<rustc_next_trait_solver[9fb1a2958be2686b]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[afbea2bae8dda0a8]::solve::delegate::SolverDelegate>, rustc_middle[93a0193236758a7b]::ty::context::TyCtxt>>::with_new_goal::<<rustc_next_trait_solver[9fb1a2958be2686b]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[afbea2bae8dda0a8]::solve::delegate::SolverDelegate, rustc_middle[93a0193236758a7b]::ty::context::TyCtxt>>::evaluate_canonical_goal::{closure#0}::{closure#0}::{closure#0}>::{closure#2}
  20:     0x7132e1d88504 - <rustc_next_trait_solver[9fb1a2958be2686b]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[afbea2bae8dda0a8]::solve::delegate::SolverDelegate, rustc_middle[93a0193236758a7b]::ty::context::TyCtxt>>::evaluate_goal_raw
  21:     0x7132e1d83792 - <rustc_trait_selection[afbea2bae8dda0a8]::solve::fulfill::FulfillmentCtxt<rustc_infer[6277e5ac1f346379]::traits::engine::ScrubbedTraitError> as rustc_infer[6277e5ac1f346379]::traits::engine::TraitEngine<rustc_infer[6277e5ac1f346379]::traits::engine::ScrubbedTraitError>>::select_where_possible
  22:     0x7132e1d82a36 - rustc_trait_selection[afbea2bae8dda0a8]::traits::impossible_predicates
  23:     0x7132e1d819a3 - <rustc_mir_transform[725d87128cd84416]::impossible_predicates::ImpossiblePredicates as rustc_mir_transform[725d87128cd84416]::pass_manager::MirPass>::run_pass
  24:     0x7132e100a4eb - rustc_mir_transform[725d87128cd84416]::run_analysis_to_runtime_passes
  25:     0x7132e125d91b - rustc_mir_transform[725d87128cd84416]::mir_drops_elaborated_and_const_checked
  26:     0x7132e125d1d9 - rustc_query_impl[fbc74060fac8c140]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[fbc74060fac8c140]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[93a0193236758a7b]::query::erase::Erased<[u8; 8usize]>>
  27:     0x7132e1256e6e - rustc_query_system[f33ca17fd4fddce8]::query::plumbing::try_execute_query::<rustc_query_impl[fbc74060fac8c140]::DynamicConfig<rustc_data_structures[4ddca31ccfde7627]::vec_cache::VecCache<rustc_span[6b6fbcae0de9ce85]::def_id::LocalDefId, rustc_middle[93a0193236758a7b]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[f33ca17fd4fddce8]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[fbc74060fac8c140]::plumbing::QueryCtxt, false>
  28:     0x7132e125669b - rustc_query_impl[fbc74060fac8c140]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  29:     0x7132e1a72ac6 - <rustc_middle[93a0193236758a7b]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[c880869786bb6952]::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}
  30:     0x7132e1a702a8 - rustc_interface[c880869786bb6952]::passes::analysis
  31:     0x7132e1a6f76d - rustc_query_impl[fbc74060fac8c140]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[fbc74060fac8c140]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[93a0193236758a7b]::query::erase::Erased<[u8; 0usize]>>
  32:     0x7132e206994e - rustc_query_system[f33ca17fd4fddce8]::query::plumbing::try_execute_query::<rustc_query_impl[fbc74060fac8c140]::DynamicConfig<rustc_query_system[f33ca17fd4fddce8]::query::caches::SingleCache<rustc_middle[93a0193236758a7b]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[fbc74060fac8c140]::plumbing::QueryCtxt, false>
  33:     0x7132e2069536 - rustc_query_impl[fbc74060fac8c140]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7132e22a5b56 - rustc_interface[c880869786bb6952]::passes::create_and_enter_global_ctxt::<core[26657d77fe39fc47]::option::Option<rustc_interface[c880869786bb6952]::queries::Linker>, rustc_driver_impl[8279e16dc5823618]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  35:     0x7132e2266aa3 - rustc_interface[c880869786bb6952]::interface::run_compiler::<(), rustc_driver_impl[8279e16dc5823618]::run_compiler::{closure#0}>::{closure#1}
  36:     0x7132e2244278 - std[cbbb60a5cfd7ff5b]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[c880869786bb6952]::util::run_in_thread_with_globals<rustc_interface[c880869786bb6952]::util::run_in_thread_pool_with_globals<rustc_interface[c880869786bb6952]::interface::run_compiler<(), rustc_driver_impl[8279e16dc5823618]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  37:     0x7132e2243f56 - <<std[cbbb60a5cfd7ff5b]::thread::Builder>::spawn_unchecked_<rustc_interface[c880869786bb6952]::util::run_in_thread_with_globals<rustc_interface[c880869786bb6952]::util::run_in_thread_pool_with_globals<rustc_interface[c880869786bb6952]::interface::run_compiler<(), rustc_driver_impl[8279e16dc5823618]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[26657d77fe39fc47]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  38:     0x7132e224253d - std::sys::pal::unix::thread::Thread::new::thread_start::h62db728285f9da4a
  39:     0x7132dbca57eb - <unknown>
  40:     0x7132dbd2918c - <unknown>
  41:                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.89.0-nightly (8a65ee082 2025-06-19) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z crate-attr=feature(min_generic_const_args) -Z crate-attr=feature(inherent_associated_types) -Z dump-mir-dir=dir

query stack during panic:
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `<impl at /tmp/icemaker_global_tempdir.qSyg1Em1SDMq/rustc_testrunner_tmpdir_reporting.eyZ7FFhpmB5o/mvce.rs:3:1: 3:17>::foo`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors; 2 warnings emitted

Some errors have detailed explanations: E0412, E0601, E0747.
For more information about an error, try `rustc --explain E0412`.

@rustbot label +F-min_generic_const_args +F-inherent_associated_types

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Status

    Dont' Worry (mGCA)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions