Skip to content

ICE:rustc panicked at compiler\rustc_hir_analysis\src\hir_ty_lowering\mod.rs:2315:13 #137888

Open
@sososopy

Description

@sososopy

Possible repetition of question #127972

Code

#![feature(generic_const_exprs)]
macro_rules! empty {
    () => ();
}
fn bar<const N: i32>() -> [(); {
       empty! {};
       N
   }] {
}
fn main() {}

Meta

rustc --version --verbose:

rustc 1.87.0-nightly (8c392966a 2025-03-01)
binary: rustc
commit-hash: 8c392966a013fd8a09e6b78b3c8d6e442bc278e1
commit-date: 2025-03-01
host: x86_64-pc-windows-msvc
release: 1.87.0-nightly
LLVM version: 20.1.0

Error output

warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
  --> .\ttt\test.rs:53:12
   |
53 | #![feature(generic_const_exprs)]
   |            ^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
   = note: `#[warn(incomplete_features)]` on by default

error: internal compiler error: compiler\rustc_hir_analysis\src\hir_ty_lowering\mod.rs:2315:13: try_lower_anon_const_lit: received const param which shouldn't be possible
  --> .\ttt\test.rs:59:8
   |
59 |        N
   |        ^
Backtrace

thread 'rustc' panicked at compiler\rustc_hir_analysis\src\hir_ty_lowering\mod.rs:2315:13:
Box<dyn Any>
stack backtrace:
   0:     0x7ff8a45f6b8e - std::backtrace_rs::backtrace::win64::trace
                               at /rustc/8c392966a013fd8a09e6b78b3c8d6e442bc278e1/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
   1:     0x7ff8a45f6b8e - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/8c392966a013fd8a09e6b78b3c8d6e442bc278e1/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ff8a45f6b8e - std::backtrace::Backtrace::create
                               at /rustc/8c392966a013fd8a09e6b78b3c8d6e442bc278e1/library\std\src\backtrace.rs:331
   3:     0x7ff8a45f6aca - std::backtrace::Backtrace::force_capture
                               at /rustc/8c392966a013fd8a09e6b78b3c8d6e442bc278e1/library\std\src\backtrace.rs:312
   4:     0x7ff8a5b8e448 - core[840dbb2f2845c865]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[82a80524e948e0f0]::Level, &str), usize), <((rustc_lint_defs[82a80524e948e0f0]::Level, &str), usize) as core[840dbb2f2845c865]::cmp::PartialOrd>::lt>
   5:     0x7ff8a461424e - alloc::boxed::impl$30::call
                               at /rustc/8c392966a013fd8a09e6b78b3c8d6e442bc278e1/library\alloc\src\boxed.rs:1986
   6:     0x7ff8a461424e - std::panicking::rust_panic_with_hook
                               at /rustc/8c392966a013fd8a09e6b78b3c8d6e442bc278e1/library\std\src\panicking.rs:839
   7:     0x7ff8a7265dc3 - RINvNtNtNtNtCsbkUWnEU8R6r_4core5slice4sort6stable9quicksort9quicksortTjRNtNtCseGJQQZfSkuo_12rustc_errors7snippet10AnnotationENCINvMNtCs4ufdBmpk0L3_5alloc5sliceSB15_11sort_by_keyTINtNtBa_3cmp7ReversejEbENCNCNvMs5_NtB1c_7emitterNtB3o_12HumanEmitter18render_s
   8:     0x7ff8a72596f9 - std[47ca72d4d3ff77e3]::sys::backtrace::__rust_end_short_backtrace::<std[47ca72d4d3ff77e3]::panicking::begin_panic<rustc_errors[ab188e13c83bdd4e]::ExplicitBug>::{closure#0}, !>
   9:     0x7ff8a7254868 - std[47ca72d4d3ff77e3]::panicking::begin_panic::<rustc_errors[ab188e13c83bdd4e]::ExplicitBug>
  10:     0x7ff8a7272df5 - <rustc_errors[ab188e13c83bdd4e]::diagnostic::BugAbort as rustc_errors[ab188e13c83bdd4e]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7ff8a70fbe8f - <hashbrown[ff07c58cb9724894]::raw::RawTable<((rustc_middle[1aca9e23c1f5e2ca]::mir::interpret::GlobalAlloc, usize), rustc_middle[1aca9e23c1f5e2ca]::mir::interpret::AllocId)>>::reserve_rehash::<hashbrown[ff07c58cb9724894]::map::make_hasher<(rustc_middle[1aca9e23c1f5e2ca]::mir::interpret::GlobalAlloc, usize), rustc_middle[1aca9e23c1f5e2ca]::mir::interpret::AllocId, rustc_hash[a5ea869f66795bec]::FxBuildHasher>::{closure#0}>
  12:     0x7ff8a7197539 - rustc_middle[1aca9e23c1f5e2ca]::util::bug::span_bug_fmt::<rustc_span[f932d894d049cea0]::span_encoding::Span>
  13:     0x7ff8a71780dd - <rustc_middle[1aca9e23c1f5e2ca]::ty::consts::Const>::to_value
  14:     0x7ff8a7177eb6 - <rustc_middle[1aca9e23c1f5e2ca]::ty::consts::Const>::to_value
  15:     0x7ff8a7197479 - rustc_middle[1aca9e23c1f5e2ca]::util::bug::span_bug_fmt::<rustc_span[f932d894d049cea0]::span_encoding::Span>
  16:     0x7ff8a3edf7ee - <dyn rustc_hir_analysis[416f618b0e25329]::hir_ty_lowering::HirTyLowerer>::lower_const_arg
  17:     0x7ff8a49b7d56 - <dyn rustc_hir_analysis[416f618b0e25329]::hir_ty_lowering::HirTyLowerer>::lower_ty
  18:     0x7ff8a49b8ec4 - <dyn rustc_hir_analysis[416f618b0e25329]::hir_ty_lowering::HirTyLowerer>::lower_fn_ty
  19:     0x7ff8a3eafffa - <rustc_hir_analysis[416f618b0e25329]::collect::ItemCtxt as rustc_hir_analysis[416f618b0e25329]::hir_ty_lowering::HirTyLowerer>::probe_ty_param_bounds
  20:     0x7ff8a498f391 - <rustc_hir_analysis[416f618b0e25329]::collect::resolve_bound_vars::BoundVarContext as rustc_hir[f712dc1a8f2aa62e]::intravisit::Visitor>::visit_impl_item
  21:     0x7ff8a53b7628 - rustc_query_impl[ea048ce6c953afc7]::plumbing::query_key_hash_verify_all
  22:     0x7ff8a53a05fd - RINvNtNtCsg1k9pdWcLJk_18rustc_query_system5query8plumbing17try_execute_queryINtCsk5FBNSQLY8t_16rustc_query_impl13DynamicConfigINtNtCsiIwSlclO99C_21rustc_data_structures9vec_cache8VecCacheNtNtCslotEWgXnnMG_10rustc_span6def_id10LocalDefIdINtNtNtCs2iBQmlseRnO
  23:     0x7ff8a5285dab - RINvNtNtCsg1k9pdWcLJk_18rustc_query_system5query8plumbing17try_execute_queryINtCsk5FBNSQLY8t_16rustc_query_impl13DynamicConfigINtNtB4_6caches10DefIdCacheINtNtNtCs2iBQmlseRnO_12rustc_middle5query5erase6ErasedAhj18_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
  24:     0x7ff8a53bf548 - rustc_query_impl[ea048ce6c953afc7]::plumbing::query_key_hash_verify_all
  25:     0x7ff8a48cfcb7 - <hashbrown[ff07c58cb9724894]::raw::RawTable<(&usize, ())>>::reserve_rehash::<hashbrown[ff07c58cb9724894]::map::make_hasher<&usize, (), rustc_hash[a5ea869f66795bec]::FxBuildHasher>::{closure#0}>
  26:     0x7ff8a4982cc5 - rustc_hir_analysis[416f618b0e25329]::check_crate
  27:     0x7ff8a4934154 - <rustc_hir_analysis[416f618b0e25329]::collect::generics_of::has_late_bound_regions::LateBoundRegionsDetector as rustc_hir[f712dc1a8f2aa62e]::intravisit::Visitor>::visit_ty
  28:     0x7ff8a53b69b8 - rustc_query_impl[ea048ce6c953afc7]::plumbing::query_key_hash_verify_all
  29:     0x7ff8a5285d8f - RINvNtNtCsg1k9pdWcLJk_18rustc_query_system5query8plumbing17try_execute_queryINtCsk5FBNSQLY8t_16rustc_query_impl13DynamicConfigINtNtB4_6caches10DefIdCacheINtNtNtCs2iBQmlseRnO_12rustc_middle5query5erase6ErasedAhj18_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
  30:     0x7ff8a53bcbc7 - rustc_query_impl[ea048ce6c953afc7]::plumbing::query_key_hash_verify_all
  31:     0x7ff8a497d009 - rustc_hir_analysis[416f618b0e25329]::check_crate
  32:     0x7ff8a53b5a03 - rustc_query_impl[ea048ce6c953afc7]::plumbing::query_key_hash_verify_all
  33:     0x7ff8a52858ce - RINvNtNtCsg1k9pdWcLJk_18rustc_query_system5query8plumbing17try_execute_queryINtCsk5FBNSQLY8t_16rustc_query_impl13DynamicConfigINtNtB4_6caches10DefIdCacheINtNtNtCs2iBQmlseRnO_12rustc_middle5query5erase6ErasedAhj18_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
  34:     0x7ff8a53bace7 - rustc_query_impl[ea048ce6c953afc7]::plumbing::query_key_hash_verify_all
  35:     0x7ff8a4941c55 - <rustc_hir_analysis[416f618b0e25329]::collect::CollectItemTypesVisitor as rustc_hir[f712dc1a8f2aa62e]::intravisit::Visitor>::visit_item
  36:     0x7ff8a490a626 - rustc_hir_analysis[416f618b0e25329]::check::wfcheck::check_well_formed
  37:     0x7ff8a53b625b - rustc_query_impl[ea048ce6c953afc7]::plumbing::query_key_hash_verify_all
  38:     0x7ff8a52ff227 - RINvNtNtCsg1k9pdWcLJk_18rustc_query_system5query8plumbing17try_execute_queryINtCsk5FBNSQLY8t_16rustc_query_impl13DynamicConfigINtNtCsiIwSlclO99C_21rustc_data_structures9vec_cache8VecCacheNtNtCslotEWgXnnMG_10rustc_span6def_id10LocalDefIdINtNtNtCs2iBQmlseRnO
  39:     0x7ff8a53c5746 - rustc_query_impl[ea048ce6c953afc7]::plumbing::query_key_hash_verify_all
  40:     0x7ff8a491d516 - rustc_hir_analysis[416f618b0e25329]::check::wfcheck::check_mod_type_wf
  41:     0x7ff8a419009b - RINvNtNtCsg1k9pdWcLJk_18rustc_query_system5query8plumbing17try_execute_queryINtCsk5FBNSQLY8t_16rustc_query_impl13DynamicConfigINtNtCsiIwSlclO99C_21rustc_data_structures9vec_cache8VecCacheNtNtCslotEWgXnnMG_10rustc_span6def_id8CrateNumINtNtNtCs2iBQmlseRnO_12
  42:     0x7ff8a40e39b6 - RINvNtNtCsg1k9pdWcLJk_18rustc_query_system5query8plumbing17try_execute_queryINtCsk5FBNSQLY8t_16rustc_query_impl13DynamicConfigINtNtB4_6caches12DefaultCacheNtNtCslotEWgXnnMG_10rustc_span6def_id13LocalModDefIdINtNtNtCs2iBQmlseRnO_12rustc_middle5query5erase6E
  43:     0x7ff8a41a35c1 - rustc_query_impl[ea048ce6c953afc7]::query_system
  44:     0x7ff8a496158a - rustc_hir_analysis[416f618b0e25329]::check_crate
  45:     0x7ff8a468928f - rustc_interface[30f504d58a964a28]::passes::resolver_for_lowering_raw
  46:     0x7ff8a0ff74d9 - rustc_interface[30f504d58a964a28]::passes::analysis
  47:     0x7ff8a4192caa - RINvNtNtCsg1k9pdWcLJk_18rustc_query_system5query8plumbing17try_execute_queryINtCsk5FBNSQLY8t_16rustc_query_impl13DynamicConfigINtNtCsiIwSlclO99C_21rustc_data_structures9vec_cache8VecCacheNtNtCslotEWgXnnMG_10rustc_span6def_id8CrateNumINtNtNtCs2iBQmlseRnO_12
  48:     0x7ff8a40a51f4 - RINvNtNtCsg1k9pdWcLJk_18rustc_query_system5query8plumbing17try_execute_queryINtCsk5FBNSQLY8t_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCs2iBQmlseRnO_12rustc_middle5query5erase6ErasedAhj0_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
  49:     0x7ff8a41987a4 - rustc_query_impl[ea048ce6c953afc7]::query_system
  50:     0x7ff8a0fbd7d2 - RINvNtNtCs6a8JjPkqOIx_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCs4ufdBmpk0L3_5alloc5boxed3BoxDINtNtNtCsbkUWnEU8R6r_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECsccF
  51:     0x7ff8a0fb5d64 - RINvNtNtCs6a8JjPkqOIx_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCs4ufdBmpk0L3_5alloc5boxed3BoxDINtNtNtCsbkUWnEU8R6r_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECsccF
  52:     0x7ff8a0fae383 - RINvNtNtCs6a8JjPkqOIx_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCs4cB2S276j5A_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCsccFkNLNd5xy_17rustc_driver_i
  53:     0x7ff8a0fc29d0 - RINvNtNtCs6a8JjPkqOIx_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCs4ufdBmpk0L3_5alloc5boxed3BoxDINtNtNtCsbkUWnEU8R6r_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECsccF
  54:     0x7ff8a46249ed - alloc::boxed::impl$28::call_once
                               at /rustc/8c392966a013fd8a09e6b78b3c8d6e442bc278e1/library\alloc\src\boxed.rs:1972
  55:     0x7ff8a46249ed - alloc::boxed::impl$28::call_once
                               at /rustc/8c392966a013fd8a09e6b78b3c8d6e442bc278e1/library\alloc\src\boxed.rs:1972
  56:     0x7ff8a46249ed - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/8c392966a013fd8a09e6b78b3c8d6e442bc278e1/library\std\src\sys\pal\windows\thread.rs:56
  57:     0x7ff9697d7374 - BaseThreadInitThunk
  58:     0x7ff969b3cc91 - RtlUserThreadStart


rustc version: 1.87.0-nightly (8c392966a 2025-03-01)
platform: x86_64-pc-windows-msvc

query stack during panic:
#0 [fn_sig] computing function signature of `bar`
#1 [explicit_predicates_of] computing explicit predicates of `bar`
#2 [predicates_of] computing predicates of `bar`
#3 [check_well_formed] checking that `bar` is well-formed
#4 [check_mod_type_wf] checking that types are well-formed in top-level module
#5 [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-generic_const_exprs`#![feature(generic_const_exprs)]`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