Skip to content

[ICE]: symbol_names: unsupported constant of type #156294

Description

@matthiaskrgr

snippet:

//@compile-flags: -Clink-dead-code=true -Znext-solver=globally --crate-type=lib
#![feature(min_generic_const_args)]
#![feature(generic_const_args)]
#![feature(adt_const_params, lazy_type_alias)]
type Matrix = [usize; 1];
const EMPTY_MATRIX: Matrix = [1];
struct Walk<const REMAINING: Matrix>;
impl Walk<EMPTY_MATRIX> {
    fn new() {}
}

Version information

rustc 1.97.0-nightly (ffccab6ab 2026-05-07)
binary: rustc
commit-hash: ffccab6abef68b70c5e23cfbfb1ac7680104040d
commit-date: 2026-05-07
host: x86_64-unknown-linux-gnu
release: 1.97.0-nightly
LLVM version: 22.1.4

Possibly related line of code:

}
self.push("E");
}
}
}
_ => {
bug!("symbol_names: unsupported constant of type `{}` ({:?})", ct_ty, ct);
}
}
// Only cache consts that do not refer to an enclosing
// binder (which would change depending on context).
if !ct.has_escaping_bound_vars() {

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Clink-dead-code=true -Zcrate-attr=feature(min_generic_const_args) -Znext-solver=globally -Zcrate-attr=feature(generic_const_args) --crate-type=lib

Program output

warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.WwBfTMxQwjZ9/rustc_testrunner_tmpdir_reporting.JLhyj1UfHy23/mvce.rs:1:30
  |
1 | #![feature(adt_const_params, lazy_type_alias)]
  |                              ^^^^^^^^^^^^^^^
  |
  = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
  = note: `#[warn(incomplete_features)]` on by default

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

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

warning: type alias `Matrix` is never used
 --> /tmp/icemaker_global_tempdir.WwBfTMxQwjZ9/rustc_testrunner_tmpdir_reporting.JLhyj1UfHy23/mvce.rs:2:6
  |
2 | type Matrix = [usize; 1];
  |      ^^^^^^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: constant `EMPTY_MATRIX` is never used
 --> /tmp/icemaker_global_tempdir.WwBfTMxQwjZ9/rustc_testrunner_tmpdir_reporting.JLhyj1UfHy23/mvce.rs:3:7
  |
3 | const EMPTY_MATRIX: Matrix = [1];
  |       ^^^^^^^^^^^^

warning: struct `Walk` is never constructed
 --> /tmp/icemaker_global_tempdir.WwBfTMxQwjZ9/rustc_testrunner_tmpdir_reporting.JLhyj1UfHy23/mvce.rs:4:8
  |
4 | struct Walk<const REMAINING: Matrix>;
  |        ^^^^

warning: associated function `new` is never used
 --> /tmp/icemaker_global_tempdir.WwBfTMxQwjZ9/rustc_testrunner_tmpdir_reporting.JLhyj1UfHy23/mvce.rs:6:8
  |
5 | impl Walk<EMPTY_MATRIX> {
  | ----------------------- associated function in this implementation
6 |     fn new() {}
  |        ^^^

error: internal compiler error: /rustc-dev/ffccab6abef68b70c5e23cfbfb1ac7680104040d/compiler/rustc_symbol_mangling/src/v0.rs:838:17: symbol_names: unsupported constant of type `Matrix` (Branch([1_usize]): Matrix)


thread 'rustc' (3925605) panicked at /rustc-dev/ffccab6abef68b70c5e23cfbfb1ac7680104040d/compiler/rustc_symbol_mangling/src/v0.rs:838:17:
Box<dyn Any>
stack backtrace:
   0:     0x7f370c065859 - <<std[b44b2a9af91b8814]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[5fd9be8f539cadc0]::fmt::Display>::fmt
   1:     0x7f370c61b748 - core[5fd9be8f539cadc0]::fmt::write
   2:     0x7f370c07c286 - <std[b44b2a9af91b8814]::sys::stdio::unix::Stderr as std[b44b2a9af91b8814]::io::Write>::write_fmt
   3:     0x7f370c03b8fe - std[b44b2a9af91b8814]::panicking::default_hook::{closure#0}
   4:     0x7f370c058f13 - std[b44b2a9af91b8814]::panicking::default_hook
   5:     0x7f370af4a431 - std[b44b2a9af91b8814]::panicking::update_hook::<alloc[52580bf504f902c0]::boxed::Box<rustc_driver_impl[b097e61246baddd0]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f370c0591f2 - std[b44b2a9af91b8814]::panicking::panic_with_hook
   7:     0x7f370af77e91 - std[b44b2a9af91b8814]::panicking::begin_panic::<rustc_errors[7dc0ae575d2f60e7]::ExplicitBug>::{closure#0}
   8:     0x7f370af70e86 - std[b44b2a9af91b8814]::sys::backtrace::__rust_end_short_backtrace::<std[b44b2a9af91b8814]::panicking::begin_panic<rustc_errors[7dc0ae575d2f60e7]::ExplicitBug>::{closure#0}, !>
   9:     0x7f370af70beb - std[b44b2a9af91b8814]::panicking::begin_panic::<rustc_errors[7dc0ae575d2f60e7]::ExplicitBug>
  10:     0x7f370af83371 - <rustc_errors[7dc0ae575d2f60e7]::diagnostic::BugAbort as rustc_errors[7dc0ae575d2f60e7]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7f370b5908f9 - rustc_middle[a2cb8ab9f4e9488e]::util::bug::opt_span_bug_fmt::<rustc_span[d4e956e734626f0]::span_encoding::Span>::{closure#0}
  12:     0x7f370b590a62 - rustc_middle[a2cb8ab9f4e9488e]::ty::context::tls::with_opt::<rustc_middle[a2cb8ab9f4e9488e]::util::bug::opt_span_bug_fmt<rustc_span[d4e956e734626f0]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  13:     0x7f370b57f6cb - rustc_middle[a2cb8ab9f4e9488e]::ty::context::tls::with_context_opt::<rustc_middle[a2cb8ab9f4e9488e]::ty::context::tls::with_opt<rustc_middle[a2cb8ab9f4e9488e]::util::bug::opt_span_bug_fmt<rustc_span[d4e956e734626f0]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  14:     0x7f3708f61b24 - rustc_middle[a2cb8ab9f4e9488e]::util::bug::bug_fmt
  15:     0x7f370e213afd - <rustc_symbol_mangling[9c5633ec7d669aa9]::v0::V0SymbolMangler as rustc_middle[a2cb8ab9f4e9488e]::ty::print::Printer>::print_const.cold
  16:     0x7f370cfa0c9f - <rustc_symbol_mangling[9c5633ec7d669aa9]::v0::V0SymbolMangler as rustc_middle[a2cb8ab9f4e9488e]::ty::print::Printer>::print_def_path
  17:     0x7f370cf9c561 - <rustc_symbol_mangling[9c5633ec7d669aa9]::v0::V0SymbolMangler as rustc_middle[a2cb8ab9f4e9488e]::ty::print::Printer>::print_type
  18:     0x7f370cf9efeb - <rustc_symbol_mangling[9c5633ec7d669aa9]::v0::V0SymbolMangler as rustc_middle[a2cb8ab9f4e9488e]::ty::print::Printer>::print_def_path
  19:     0x7f370cf9d564 - <rustc_symbol_mangling[9c5633ec7d669aa9]::v0::V0SymbolMangler as rustc_middle[a2cb8ab9f4e9488e]::ty::print::Printer>::print_def_path
  20:     0x7f370cf99401 - rustc_symbol_mangling[9c5633ec7d669aa9]::symbol_name_provider
  21:     0x7f370cf987d5 - rustc_query_impl[469555595b0d02a6]::query_impl::symbol_name::invoke_provider_fn::__rust_begin_short_backtrace
  22:     0x7f370cf977b0 - rustc_query_impl[469555595b0d02a6]::execution::try_execute_query::<rustc_middle[a2cb8ab9f4e9488e]::query::caches::DefaultCache<rustc_middle[a2cb8ab9f4e9488e]::ty::instance::Instance, rustc_middle[a2cb8ab9f4e9488e]::query::erase::ErasedData<[u8; 16usize]>>, false>
  23:     0x7f370cf97442 - rustc_query_impl[469555595b0d02a6]::query_impl::symbol_name::execute_query_non_incr::__rust_end_short_backtrace
  24:     0x7f370cf96f43 - rustc_monomorphize[5ab1e60d2de18f3f]::partitioning::assert_symbols_are_distinct::<core[5fd9be8f539cadc0]::slice::iter::Iter<rustc_middle[a2cb8ab9f4e9488e]::mono::MonoItem>>
  25:     0x7f370d10f1a1 - rustc_monomorphize[5ab1e60d2de18f3f]::partitioning::collect_and_partition_mono_items
  26:     0x7f370d78a7e0 - rustc_query_impl[469555595b0d02a6]::query_impl::collect_and_partition_mono_items::invoke_provider_fn::__rust_begin_short_backtrace
  27:     0x7f370d78a136 - rustc_query_impl[469555595b0d02a6]::execution::try_execute_query::<rustc_middle[a2cb8ab9f4e9488e]::query::caches::SingleCache<rustc_middle[a2cb8ab9f4e9488e]::query::erase::ErasedData<[u8; 24usize]>>, false>
  28:     0x7f370d789ecc - rustc_query_impl[469555595b0d02a6]::query_impl::collect_and_partition_mono_items::execute_query_non_incr::__rust_end_short_backtrace
  29:     0x7f370cfe4e9f - rustc_codegen_ssa[a1f415a7bf6a480b]::back::symbol_export::exported_generic_symbols_provider_local
  30:     0x7f370d5d3e68 - rustc_query_impl[469555595b0d02a6]::query_impl::exported_generic_symbols::invoke_provider_fn::__rust_begin_short_backtrace
  31:     0x7f370d5d20f1 - rustc_query_impl[469555595b0d02a6]::execution::try_execute_query::<rustc_data_structures[fddbf0b6d549df5f]::vec_cache::VecCache<rustc_span[d4e956e734626f0]::def_id::CrateNum, rustc_middle[a2cb8ab9f4e9488e]::query::erase::ErasedData<[u8; 16usize]>, rustc_middle[a2cb8ab9f4e9488e]::dep_graph::graph::DepNodeIndex>, false>
  32:     0x7f370d5d1c03 - rustc_query_impl[469555595b0d02a6]::query_impl::exported_generic_symbols::execute_query_non_incr::__rust_end_short_backtrace
  33:     0x7f370d5eb9d4 - <rustc_metadata[bac4f2ae346852a7]::rmeta::encoder::EncodeContext>::encode_crate_root
  34:     0x7f370d95e5a3 - rustc_metadata[bac4f2ae346852a7]::rmeta::encoder::encode_metadata::{closure#3}
  35:     0x7f370d95b8e7 - rustc_metadata[bac4f2ae346852a7]::rmeta::encoder::encode_metadata
  36:     0x7f370d29bfcb - rustc_metadata[bac4f2ae346852a7]::fs::encode_and_write_metadata
  37:     0x7f370d7d70fb - <rustc_interface[4f993990338980d2]::queries::Linker>::codegen_and_build_linker
  38:     0x7f370d7d18cb - rustc_interface[4f993990338980d2]::interface::run_compiler::<(), rustc_driver_impl[b097e61246baddd0]::run_compiler::{closure#0}>::{closure#1}
  39:     0x7f370d78187e - std[b44b2a9af91b8814]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[4f993990338980d2]::util::run_in_thread_with_globals<rustc_interface[4f993990338980d2]::util::run_in_thread_pool_with_globals<rustc_interface[4f993990338980d2]::interface::run_compiler<(), rustc_driver_impl[b097e61246baddd0]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  40:     0x7f370d781f6d - <std[b44b2a9af91b8814]::thread::lifecycle::spawn_unchecked<rustc_interface[4f993990338980d2]::util::run_in_thread_with_globals<rustc_interface[4f993990338980d2]::util::run_in_thread_pool_with_globals<rustc_interface[4f993990338980d2]::interface::run_compiler<(), rustc_driver_impl[b097e61246baddd0]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[5fd9be8f539cadc0]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x7f370d782d6c - <std[b44b2a9af91b8814]::sys::thread::unix::Thread>::new::thread_start
  42:     0x7f37072a597a - <unknown>
  43:     0x7f37073292bc - <unknown>
  44:                0x0 - <unknown>

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.97.0-nightly (ffccab6ab 2026-05-07) running on x86_64-unknown-linux-gnu

note: compiler flags: -C link-dead-code=true -Z crate-attr=feature(min_generic_const_args) -Z next-solver=globally -Z crate-attr=feature(generic_const_args) --crate-type lib -Z dump-mir-dir=dir

query stack during panic:
#0 [symbol_name] computing the symbol for `<impl at /tmp/icemaker_global_tempdir.WwBfTMxQwjZ9/rustc_testrunner_tmpdir_reporting.JLhyj1UfHy23/mvce.rs:5:1: 5:24>::new`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
#2 [exported_generic_symbols] collecting exported generic symbols for crate `0`
end of query stack
error: aborting due to 1 previous error; 7 warnings emitted


@rustbot label +F-adt_const_params +F-lazy_type_alias +F-min_generic_const_args +F-generic_const_args +WG-trait-system-refactor

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-adt_const_params`#![feature(adt_const_params)]`F-generic_const_args`#![feature(generic_const_args)]`F-lazy_type_alias`#![feature(lazy_type_alias)]`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.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions