Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: rustc panicked at compiler\rustc_middle\src\mir\interpret\queries.rs:104:13 #138710

Open
sososopy opened this issue Mar 19, 2025 · 1 comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@sososopy
Copy link

Code

#![feature(min_generic_const_args)]
trait B {
    type n: A;
}
trait A {
    const N: usize;
}
async fn fun(
) -> Box<dyn A> {
    *(&mut [0; <<Vec<u32> as B>::n as A>::N])
}
fn main() {}

Meta

rustc --version --verbose:

rustc 1.87.0-nightly (75530e9f7 2025-03-18)
binary: rustc
commit-hash: 75530e9f72a1990ed2305e16fd51d02f47048f12
commit-date: 2025-03-18
host: x86_64-pc-windows-msvc
release: 1.87.0-nightly
LLVM version: 20.1.0

Error output

error[E0670]: `async fn` is not permitted in Rust 2015
   --> .\ttt\test.rs:150:1
    |
150 | async fn fun(
    | ^^^^^ to use `async fn`, switch to Rust 2018 or later
    |
    = help: pass `--edition 2024` to `rustc`
    = note: for more on editions, read https://doc.rust-lang.org/edition-guide

warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
   --> .\ttt\test.rs:143:12
    |
143 | #![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: associated type `n` should have an upper camel case name
   --> .\ttt\test.rs:145:10
    |
145 |     type n: A;
    |          ^ help: convert the identifier to upper camel case: `N`
    |
    = note: `#[warn(non_camel_case_types)]` on by default

error: internal compiler error: compiler\rustc_middle\src\mir\interpret\queries.rs:104:13: did not expect inference variables here
Backtrace

thread 'rustc' panicked at compiler\rustc_middle\src\mir\interpret\queries.rs:104:13:
Box<dyn Any>
stack backtrace:
   0:     0x7ffa7493d122 - std::backtrace_rs::backtrace::win64::trace
                               at /rustc/75530e9f72a1990ed2305e16fd51d02f47048f12/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
   1:     0x7ffa7493d122 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/75530e9f72a1990ed2305e16fd51d02f47048f12/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffa7493d122 - std::sys::backtrace::_print_fmt
                               at /rustc/75530e9f72a1990ed2305e16fd51d02f47048f12/library\std\src\sys\backtrace.rs:66
   3:     0x7ffa7493d122 - std::sys::backtrace::impl$0::print::impl$0::fmt
                               at /rustc/75530e9f72a1990ed2305e16fd51d02f47048f12/library\std\src\sys\backtrace.rs:39
   4:     0x7ffa749706fa - core::fmt::rt::Argument::fmt
                               at /rustc/75530e9f72a1990ed2305e16fd51d02f47048f12/library\core\src\fmt\rt.rs:185
   5:     0x7ffa749706fa - core::fmt::write
                               at /rustc/75530e9f72a1990ed2305e16fd51d02f47048f12/library\core\src\fmt\mod.rs:1449
   6:     0x7ffa74932fd7 - std::io::Write::write_fmt<std::sys::stdio::windows::Stderr>
                               at /rustc/75530e9f72a1990ed2305e16fd51d02f47048f12/library\std\src\io\mod.rs:1890
   7:     0x7ffa7493cf65 - std::sys::backtrace::BacktraceLock::print
                               at /rustc/75530e9f72a1990ed2305e16fd51d02f47048f12/library\std\src\sys\backtrace.rs:42
   8:     0x7ffa7494156a - std::panicking::default_hook::closure$0
                               at /rustc/75530e9f72a1990ed2305e16fd51d02f47048f12/library\std\src\panicking.rs:300
   9:     0x7ffa74941300 - std::panicking::default_hook
                               at /rustc/75530e9f72a1990ed2305e16fd51d02f47048f12/library\std\src\panicking.rs:327
  10:     0x7ffa75fe99f0 - core[4bd2dcde7a8538f3]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[4df486249f31527]::Level, &str), usize), <((rustc_lint_defs[4df486249f31527]::Level, &str), usize) as core[4bd2dcde7a8538f3]::cmp::PartialOrd>::lt>
  11:     0x7ffa749421fe - std::panicking::rust_panic_with_hook
                               at /rustc/75530e9f72a1990ed2305e16fd51d02f47048f12/library\std\src\panicking.rs:841
  12:     0x7ffa77804093 - RINvNtNtNtNtCs6vBFW3HcVWh_4core5slice4sort6stable9quicksort9quicksortTjRNtNtCs2X9PwUsabrX_12rustc_errors7snippet10AnnotationENCINvMNtCsgJQlKUZqHNb_5alloc5sliceSB15_11sort_by_keyTINtNtBa_3cmp7ReversejEbENCNCNvMs5_NtB1c_7emitterNtB3o_12HumanEmitter18render_s
  13:     0x7ffa777f7869 - std[525396dd3efe97a2]::sys::backtrace::__rust_end_short_backtrace::<std[525396dd3efe97a2]::panicking::begin_panic<rustc_errors[2268b783922e1de3]::ExplicitBug>::{closure#0}, !>
  14:     0x7ffa777f7558 - std[525396dd3efe97a2]::panicking::begin_panic::<rustc_errors[2268b783922e1de3]::ExplicitBug>
  15:     0x7ffa778110d5 - <rustc_errors[2268b783922e1de3]::diagnostic::BugAbort as rustc_errors[2268b783922e1de3]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  16:     0x7ffa77751a99 - rustc_middle[2ca44cb49e785db0]::util::bug::span_bug_fmt::<rustc_span[291b0188f31a9841]::span_encoding::Span>
  17:     0x7ffa7772642d - <rustc_middle[2ca44cb49e785db0]::ty::consts::Const>::to_value
  18:     0x7ffa777261f6 - <rustc_middle[2ca44cb49e785db0]::ty::consts::Const>::to_value
  19:     0x7ffa77751992 - rustc_middle[2ca44cb49e785db0]::util::bug::bug_fmt
  20:     0x7ffa747c8659 - <rustc_middle[2ca44cb49e785db0]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
  21:     0x7ffa745e0051 - rustc_trait_selection[5359b1f66c87a9f8]::traits::try_evaluate_const
  22:     0x7ffa745d7282 - <rustc_trait_selection[5359b1f66c87a9f8]::traits::normalize::AssocTypeNormalizer as rustc_type_ir[c94b58d90e9f0de2]::fold::TypeFolder<rustc_middle[2ca44cb49e785db0]::ty::context::TyCtxt>>::fold_const  23:     0x7ffa7412b40d - <rustc_hir_typeck[9bf70a45b2bbec25]::fallback::compute_unsafe_infer_vars::UnsafeInferVarsVisitor as rustc_hir[c01faa49446c726b]::intravisit::Visitor>::visit_expr
  24:     0x7ffa74ae664d - <<rustc_hir_typeck[9bf70a45b2bbec25]::fn_ctxt::FnCtxt>::deduce_closure_signature_from_predicates::MentionsTy as rustc_type_ir[c94b58d90e9f0de2]::visit::TypeVisitor<rustc_middle[2ca44cb49e785db0]::ty::context::TyCtxt>>::visit_ty
  25:     0x7ffa74ae10b4 - <<rustc_hir_typeck[9bf70a45b2bbec25]::fn_ctxt::FnCtxt>::deduce_closure_signature_from_predicates::MentionsTy as rustc_type_ir[c94b58d90e9f0de2]::visit::TypeVisitor<rustc_middle[2ca44cb49e785db0]::ty::context::TyCtxt>>::visit_ty
  26:     0x7ffa74ae2a8c - <<rustc_hir_typeck[9bf70a45b2bbec25]::fn_ctxt::FnCtxt>::deduce_closure_signature_from_predicates::MentionsTy as rustc_type_ir[c94b58d90e9f0de2]::visit::TypeVisitor<rustc_middle[2ca44cb49e785db0]::ty::context::TyCtxt>>::visit_ty
  27:     0x7ffa74b46e3e - <<rustc_hir_typeck[9bf70a45b2bbec25]::fn_ctxt::FnCtxt>::deduce_closure_signature_from_predicates::MentionsTy as rustc_type_ir[c94b58d90e9f0de2]::visit::TypeVisitor<rustc_middle[2ca44cb49e785db0]::ty::context::TyCtxt>>::visit_ty
  28:     0x7ffa74ae0a96 - <<rustc_hir_typeck[9bf70a45b2bbec25]::fn_ctxt::FnCtxt>::deduce_closure_signature_from_predicates::MentionsTy as rustc_type_ir[c94b58d90e9f0de2]::visit::TypeVisitor<rustc_middle[2ca44cb49e785db0]::ty::context::TyCtxt>>::visit_ty
  29:     0x7ffa74ae2862 - <<rustc_hir_typeck[9bf70a45b2bbec25]::fn_ctxt::FnCtxt>::deduce_closure_signature_from_predicates::MentionsTy as rustc_type_ir[c94b58d90e9f0de2]::visit::TypeVisitor<rustc_middle[2ca44cb49e785db0]::ty::context::TyCtxt>>::visit_ty
  30:     0x7ffa74b46e3e - <<rustc_hir_typeck[9bf70a45b2bbec25]::fn_ctxt::FnCtxt>::deduce_closure_signature_from_predicates::MentionsTy as rustc_type_ir[c94b58d90e9f0de2]::visit::TypeVisitor<rustc_middle[2ca44cb49e785db0]::ty::context::TyCtxt>>::visit_ty
  31:     0x7ffa74ae0a96 - <<rustc_hir_typeck[9bf70a45b2bbec25]::fn_ctxt::FnCtxt>::deduce_closure_signature_from_predicates::MentionsTy as rustc_type_ir[c94b58d90e9f0de2]::visit::TypeVisitor<rustc_middle[2ca44cb49e785db0]::ty::context::TyCtxt>>::visit_ty
  32:     0x7ffa74ba16a2 - rustc_hir_typeck[9bf70a45b2bbec25]::typeck
  33:     0x7ffa74ba5bcf - rustc_hir_typeck[9bf70a45b2bbec25]::typeck
  34:     0x7ffa74ae4d73 - <<rustc_hir_typeck[9bf70a45b2bbec25]::fn_ctxt::FnCtxt>::deduce_closure_signature_from_predicates::MentionsTy as rustc_type_ir[c94b58d90e9f0de2]::visit::TypeVisitor<rustc_middle[2ca44cb49e785db0]::ty::context::TyCtxt>>::visit_ty
  35:     0x7ffa74ba16a2 - rustc_hir_typeck[9bf70a45b2bbec25]::typeck
  36:     0x7ffa74befd11 - <rustc_hir_typeck[9bf70a45b2bbec25]::upvar::InferBorrowKind as rustc_hir_typeck[9bf70a45b2bbec25]::expr_use_visitor::Delegate>::borrow
  37:     0x7ffa74ba0cff - rustc_hir_typeck[9bf70a45b2bbec25]::typeck
  38:     0x7ffa757b210b - rustc_query_impl[46bdf6b845ac6228]::plumbing::query_key_hash_verify_all
  39:     0x7ffa756ed331 - RINvNtNtCs4Z8kyESZuV2_18rustc_query_system5query8plumbing17try_execute_queryINtCs64yBUGAzzG6_16rustc_query_impl13DynamicConfigINtNtCs3AyyIkZFuiE_21rustc_data_structures9vec_cache8VecCacheNtNtCs3wNOViAsE9h_10rustc_span6def_id10LocalDefIdINtNtNtCs3PCT4mVwuES
  40:     0x7ffa757ba652 - rustc_query_impl[46bdf6b845ac6228]::plumbing::query_key_hash_verify_all
  41:     0x7ffa74188dfc - <rustc_hir_analysis[66fbcca35168662]::collect::type_of::opaque::RpitConstraintChecker as rustc_hir[c01faa49446c726b]::intravisit::Visitor>::visit_expr
  42:     0x7ffa74493c8b - <alloc[c2f974e82108fe97]::sync::Arc<rustc_session[b6badee9beb543f9]::cstore::CrateSource>>::drop_slow
  43:     0x7ffa75687d9b - RINvNtNtCs4Z8kyESZuV2_18rustc_query_system5query8plumbing17try_execute_queryINtCs64yBUGAzzG6_16rustc_query_impl13DynamicConfigINtNtB4_6caches10DefIdCacheINtNtNtCs3PCT4mVwuES_12rustc_middle5query5erase6ErasedAhj8_EEKb0_KB3r_KB3r_ENtNtB1f_8plumbing9QueryCtxt
  44:     0x7ffa7449c874 - rustc_query_impl[46bdf6b845ac6228]::query_system
  45:     0x7ffa74c9f6d2 - <rustc_hir_analysis[66fbcca35168662]::collect::resolve_bound_vars::is_late_bound_map::ConstrainedCollector as rustc_hir[c01faa49446c726b]::intravisit::Visitor>::visit_ty
  46:     0x7ffa757b2140 - rustc_query_impl[46bdf6b845ac6228]::plumbing::query_key_hash_verify_all
  47:     0x7ffa75687d9b - RINvNtNtCs4Z8kyESZuV2_18rustc_query_system5query8plumbing17try_execute_queryINtCs64yBUGAzzG6_16rustc_query_impl13DynamicConfigINtNtB4_6caches10DefIdCacheINtNtNtCs3PCT4mVwuES_12rustc_middle5query5erase6ErasedAhj8_EEKb0_KB3r_KB3r_ENtNtB1f_8plumbing9QueryCtxt
  48:     0x7ffa757b41b6 - rustc_query_impl[46bdf6b845ac6228]::plumbing::query_key_hash_verify_all
  49:     0x7ffa74164645 - rustc_hir_analysis[66fbcca35168662]::check::check::check_abi_fn_ptr
  50:     0x7ffa74c69114 - rustc_hir_analysis[66fbcca35168662]::check::wfcheck::check_well_formed
  51:     0x7ffa757b0ccb - rustc_query_impl[46bdf6b845ac6228]::plumbing::query_key_hash_verify_all
  52:     0x7ffa756e8ac7 - RINvNtNtCs4Z8kyESZuV2_18rustc_query_system5query8plumbing17try_execute_queryINtCs64yBUGAzzG6_16rustc_query_impl13DynamicConfigINtNtCs3AyyIkZFuiE_21rustc_data_structures9vec_cache8VecCacheNtNtCs3wNOViAsE9h_10rustc_span6def_id10LocalDefIdINtNtNtCs3PCT4mVwuES
  53:     0x7ffa757c0e85 - rustc_query_impl[46bdf6b845ac6228]::plumbing::query_key_hash_verify_all
  54:     0x7ffa74c79312 - rustc_hir_analysis[66fbcca35168662]::check::wfcheck::check_mod_type_wf
  55:     0x7ffa74494d5b - <alloc[c2f974e82108fe97]::sync::Arc<rustc_session[b6badee9beb543f9]::cstore::CrateSource>>::drop_slow
  56:     0x7ffa743e5196 - RINvNtNtCs4Z8kyESZuV2_18rustc_query_system5query8plumbing17try_execute_queryINtCs64yBUGAzzG6_16rustc_query_impl13DynamicConfigINtNtB4_6caches12DefaultCacheNtNtCs3wNOViAsE9h_10rustc_span6def_id13LocalModDefIdINtNtNtCs3PCT4mVwuES_12rustc_middle5query5erase6E
  57:     0x7ffa744a7bf0 - rustc_query_impl[46bdf6b845ac6228]::query_system
  58:     0x7ffa74cc1eca - rustc_hir_analysis[66fbcca35168662]::check_crate
  59:     0x7ffa749ba38f - rustc_interface[abb0def82e55dd22]::passes::resolver_for_lowering_raw
  60:     0x7ffa712b5d87 - rustc_interface[abb0def82e55dd22]::passes::analysis
  61:     0x7ffa744978da - <alloc[c2f974e82108fe97]::sync::Arc<rustc_session[b6badee9beb543f9]::cstore::CrateSource>>::drop_slow
  62:     0x7ffa743a90e4 - RINvNtNtCs4Z8kyESZuV2_18rustc_query_system5query8plumbing17try_execute_queryINtCs64yBUGAzzG6_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCs3PCT4mVwuES_12rustc_middle5query5erase6ErasedAhj0_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
  63:     0x7ffa7449d3d3 - rustc_query_impl[46bdf6b845ac6228]::query_system
  64:     0x7ffa7127d062 - RINvNtNtCs74dLTKx2NXi_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCsgJQlKUZqHNb_5alloc5boxed3BoxDINtNtNtCs6vBFW3HcVWh_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECskDA
  65:     0x7ffa71275790 - RINvNtNtCs74dLTKx2NXi_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCsgJQlKUZqHNb_5alloc5boxed3BoxDINtNtNtCs6vBFW3HcVWh_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECskDA
  66:     0x7ffa7126e5f3 - RINvNtNtCs74dLTKx2NXi_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCseJUd8D8sKWs_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCskDAJpLyeRer_17rustc_driver_i
  67:     0x7ffa71282260 - RINvNtNtCs74dLTKx2NXi_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCsgJQlKUZqHNb_5alloc5boxed3BoxDINtNtNtCs6vBFW3HcVWh_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECskDA
  68:     0x7ffa7494d98d - alloc::boxed::impl$28::call_once
                               at /rustc/75530e9f72a1990ed2305e16fd51d02f47048f12/library\alloc\src\boxed.rs:1970
  69:     0x7ffa7494d98d - alloc::boxed::impl$28::call_once
                               at /rustc/75530e9f72a1990ed2305e16fd51d02f47048f12/library\alloc\src\boxed.rs:1970
  70:     0x7ffa7494d98d - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/75530e9f72a1990ed2305e16fd51d02f47048f12/library\std\src\sys\pal\windows\thread.rs:56
  71:     0x7ffb18e17374 - BaseThreadInitThunk
  72:     0x7ffb1991cc91 - RtlUserThreadStart

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\test1\src\rustc-ice-2025-03-19T14_33_23-29960.txt` to your bug report

query stack during panic:
#0 [typeck] type-checking `fun`
#1 [type_of_opaque] computing type of opaque `fun::{opaque#0}`
... and 4 other queries... use `env RUST_BACKTRACE=1` to see the full query stack
error: aborting due to 2 previous errors; 2 warnings emitted

For more information about this error, try `rustc --explain E0670`.

@sososopy sososopy added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 19, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 19, 2025
@matthiaskrgr
Copy link
Member

probably duplicate of #133066 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants