Skip to content

ICE:unexpected DefKind for const alias to resolve to: Ctor(Struct, Const) #141738

Open
@sososopy

Description

@sososopy

The code is generated by a fuzzer and reduced manually
It may be a duplicate of #139596 , but I'm not quite sure, so I'm raising this issue.
Thank you very much for your correction.

Code

#![feature(min_generic_const_args)]
struct S
where
    ():;
fn main() {
    let b = [0; S];
}

Meta

rustc --version --verbose:

rustc 1.89.0-nightly (6f6971078 2025-05-28)
binary: rustc
commit-hash: 6f69710780d579b180ab38da4c1384d630f7bd31
commit-date: 2025-05-28
host: x86_64-pc-windows-msvc
release: 1.89.0-nightly
LLVM version: 20.1.5

Error output

<None>
Backtrace

thread 'rustc' panicked at compiler\rustc_trait_selection\src\traits\normalize.rs:465:21:
internal error: entered unreachable code: unexpected `DefKind` for const alias to resolve to: Ctor(Struct, Const)
stack backtrace:
   0:     0x7ffc6738d302 - std::backtrace_rs::backtrace::win64::trace
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
   1:     0x7ffc6738d302 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffc6738d302 - std::sys::backtrace::_print_fmt
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\std\src\sys\backtrace.rs:66
   3:     0x7ffc6738d302 - std::sys::backtrace::impl$0::print::impl$0::fmt
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\std\src\sys\backtrace.rs:39
   4:     0x7ffc673c0f4b - core::fmt::rt::Argument::fmt
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\core\src\fmt\rt.rs:173
   5:     0x7ffc673c0f4b - core::fmt::write
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\core\src\fmt\mod.rs:1446
   6:     0x7ffc67382f57 - std::io::default_write_fmt
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\std\src\io\mod.rs:639
   7:     0x7ffc67382f57 - std::io::Write::write_fmt<std::sys::stdio::windows::Stderr>
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\std\src\io\mod.rs:1914
   8:     0x7ffc6738d145 - std::sys::backtrace::BacktraceLock::print
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\std\src\sys\backtrace.rs:42
   9:     0x7ffc67392eda - std::panicking::default_hook::closure$0
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\std\src\panicking.rs:300
  10:     0x7ffc67392c70 - std::panicking::default_hook
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\std\src\panicking.rs:327
  11:     0x7ffc68ac4329 - core[769ea8e9cf7c8c7d]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[f4558975b2544dd0]::Level, &str), usize), <((rustc_lint_defs[f4558975b2544dd0]::Level, &str), usize) as core[769ea8e9cf7c8c7d]::cmp::PartialOrd>::lt>
  12:     0x7ffc67393b6e - std::panicking::rust_panic_with_hook
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\std\src\panicking.rs:841
  13:     0x7ffc673938c9 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\std\src\panicking.rs:706
  14:     0x7ffc6738e0cf - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\std\src\sys\backtrace.rs:168
  15:     0x7ffc673934ce - std::panicking::begin_panic_handler
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\std\src\panicking.rs:697
  16:     0x7ffc6a55d871 - core::panicking::panic_fmt
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\core\src\panicking.rs:75
  17:     0x7ffc67023c4b - <rustc_trait_selection[1b24f8aaa35a8324]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[aa05bae9e5233d99]::fold::TypeFolder<rustc_middle[c1b4c53fd1a321d1]::ty::context::TyCtxt>>::fold_const
  18:     0x7ffc66b766a7 - <rustc_hir_typeck[6a998e1b2e03c2e9]::fallback::compute_unsafe_infer_vars::UnsafeInferVarsVisitor as rustc_hir[9c08b404fda0d1eb]::intravisit::Visitor>::visit_expr
  19:     0x7ffc6753b106 - <<rustc_hir_typeck[6a998e1b2e03c2e9]::fn_ctxt::FnCtxt>::deduce_closure_signature_from_predicates::MentionsTy as rustc_type_ir[aa05bae9e5233d99]::visit::TypeVisitor<rustc_middle[c1b4c53fd1a321d1]::ty::context::TyCtxt>>::visit_ty
  20:     0x7ffc6759709a - <<rustc_hir_typeck[6a998e1b2e03c2e9]::fn_ctxt::FnCtxt>::deduce_closure_signature_from_predicates::MentionsTy as rustc_type_ir[aa05bae9e5233d99]::visit::TypeVisitor<rustc_middle[c1b4c53fd1a321d1]::ty::context::TyCtxt>>::visit_ty
  21:     0x7ffc67598eb4 - <<rustc_hir_typeck[6a998e1b2e03c2e9]::fn_ctxt::FnCtxt>::deduce_closure_signature_from_predicates::MentionsTy as rustc_type_ir[aa05bae9e5233d99]::visit::TypeVisitor<rustc_middle[c1b4c53fd1a321d1]::ty::context::TyCtxt>>::visit_ty
  22:     0x7ffc675359ea - <<rustc_hir_typeck[6a998e1b2e03c2e9]::fn_ctxt::FnCtxt>::deduce_closure_signature_from_predicates::MentionsTy as rustc_type_ir[aa05bae9e5233d99]::visit::TypeVisitor<rustc_middle[c1b4c53fd1a321d1]::ty::context::TyCtxt>>::visit_ty
  23:     0x7ffc675fdaf5 - rustc_hir_typeck[6a998e1b2e03c2e9]::typeck
  24:     0x7ffc676490f9 - <rustc_hir_typeck[6a998e1b2e03c2e9]::upvar::InferBorrowKind as rustc_hir_typeck[6a998e1b2e03c2e9]::expr_use_visitor::Delegate>::borrow
  25:     0x7ffc675fd19f - rustc_hir_typeck[6a998e1b2e03c2e9]::typeck
  26:     0x7ffc682f259b - rustc_query_impl[b393d98e76e94b52]::plumbing::query_key_hash_verify_all
  27:     0x7ffc6822adc4 - RINvNtNtCsfMI6HuYYhZR_18rustc_query_system5query8plumbing17try_execute_queryINtCsfpSZIrunIKQ_16rustc_query_impl13DynamicConfigINtNtCsnUnWpJNuAG_21rustc_data_structures9vec_cache8VecCacheNtNtCs6Wls0SyExpn_10rustc_span6def_id10LocalDefIdINtNtNtCsgD5MiArxEXZ_
  28:     0x7ffc682fa8e2 - rustc_query_impl[b393d98e76e94b52]::plumbing::query_key_hash_verify_all
  29:     0x7ffc67683e9d - <hashbrown[7d5516ce60af542c]::raw::RawTable<(&usize, ())>>::reserve_rehash::<hashbrown[7d5516ce60af542c]::map::make_hasher<&usize, (), rustc_hash[569a12f97809c2a5]::FxBuildHasher>::{closure#0}>  30:     0x7ffc67721392 - rustc_hir_analysis[648477c26852b4b5]::check_crate
  31:     0x7ffc673fced7 - <rustc_interface[d5ced81d2cfa3363]::passes::LintStoreExpandImpl as rustc_expand[355be66a0da8933e]::base::LintStoreExpand>::pre_expansion_lint
  32:     0x7ffc6397a2d7 - rustc_interface[d5ced81d2cfa3363]::passes::analysis
  33:     0x7ffc66f0a45a - RINvNtNtCsfMI6HuYYhZR_18rustc_query_system5query8plumbing17try_execute_queryINtCsfpSZIrunIKQ_16rustc_query_impl13DynamicConfigINtNtCsnUnWpJNuAG_21rustc_data_structures9vec_cache8VecCacheNtNtCs6Wls0SyExpn_10rustc_span6def_id8CrateNumINtNtNtCsgD5MiArxEXZ_12r
  34:     0x7ffc66e1175a - RINvNtNtCsfMI6HuYYhZR_18rustc_query_system5query8plumbing17try_execute_queryINtCsfpSZIrunIKQ_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCsgD5MiArxEXZ_12rustc_middle5query5erase6ErasedAhj0_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
  35:     0x7ffc66f10ae3 - rustc_query_impl[b393d98e76e94b52]::query_system
  36:     0x7ffc6393eef5 - std[eb40764db84001a0]::sys::backtrace::__rust_begin_short_backtrace::<<std[eb40764db84001a0]::thread::Builder>::spawn_unchecked_<ctrlc[72c1022f4145cb90]::set_handler_inner<rustc_driver_impl[7240eb012f8bd6c4]::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
  37:     0x7ffc63939165 - std[eb40764db84001a0]::sys::backtrace::__rust_begin_short_backtrace::<<std[eb40764db84001a0]::thread::Builder>::spawn_unchecked_<ctrlc[72c1022f4145cb90]::set_handler_inner<rustc_driver_impl[7240eb012f8bd6c4]::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
  38:     0x7ffc63934a0f - RINvNtNtCskceRWhH31cW_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCsim5SKrcSq7n_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCs9OaueMogfNE_17rustc_driver_i
  39:     0x7ffc6394325d - std[eb40764db84001a0]::sys::backtrace::__rust_begin_short_backtrace::<<std[eb40764db84001a0]::thread::Builder>::spawn_unchecked_<ctrlc[72c1022f4145cb90]::set_handler_inner<rustc_driver_impl[7240eb012f8bd6c4]::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
  40:     0x7ffc67397edd - alloc::boxed::impl$28::call_once
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\alloc\src\boxed.rs:1966
  41:     0x7ffc67397edd - alloc::boxed::impl$28::call_once
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\alloc\src\boxed.rs:1966
  42:     0x7ffc67397edd - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/6f69710780d579b180ab38da4c1384d630f7bd31/library\std\src\sys\pal\windows\thread.rs:56
  43:     0x7ffd27b57374 - BaseThreadInitThunk
  44:     0x7ffd2887cc91 - 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

note: please attach the file at `D:\rust_test\gpt_generate_mutators\rustc-ice-2025-05-29T14_28_37-33376.txt` to your bug report

query stack during panic:
#0 [typeck] type-checking `main`
#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) ❄️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