Skip to content

Conversation

@reddevilmidzy
Copy link
Member

@reddevilmidzy reddevilmidzy commented Jan 9, 2026

Add regression tests for subsequent mGCA tasks

edit:

resolve: #147415 tests\ui\const-generics\mgca\size-of-generic-ptr-in-array-len.rs
resolve: #141014 tests\ui\const-generics\mgca\assoc-const-projection-in-bound.rs

and crashes: 138226, 138226-2, 149809, 150960

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 9, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 9, 2026

r? @JonathanBrouwer

rustbot has assigned @JonathanBrouwer.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@BoxyUwU
Copy link
Member

BoxyUwU commented Jan 9, 2026

r? BoxyUwU

@rustbot rustbot assigned BoxyUwU and unassigned JonathanBrouwer Jan 9, 2026
@reddevilmidzy reddevilmidzy force-pushed the mgca-test branch 2 times, most recently from 28c9775 to 51da0b7 Compare January 10, 2026 03:14
Comment on lines +14 to +25
impl<T: Abc> A for T {
#[type_const]
const VALUE: usize = 0;
}

trait S<const K: usize> {}

trait Handler<T: Abc>
where
(): S<{ <T as A>::VALUE }>,
{
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ICE was also reproduced in code like this.

https://godbolt.org/z/fbvWGv49a

@reddevilmidzy
Copy link
Member Author

Thanks for your quick check! I'll add more tests to address the resolved mGCA ICE issue.

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 10, 2026
@reddevilmidzy
Copy link
Member Author

#138226, #138227

Looks like these two ICEs are happening again in rustc 1.94.0-dev. 🤔

@Kivooeo
Copy link
Member

Kivooeo commented Jan 10, 2026

Looks like these two ICEs are happening again in rustc 1.94.0-dev.

I can't reproduce it on playground

@reddevilmidzy
Copy link
Member Author

reddevilmidzy commented Jan 10, 2026

I can't reproduce it on playground

If I pull the latest main locally and then run this test, I get an ICE.

//! regression test for <https://github.com/rust-lang/rust/issues/138226>
//! and <https://github.com/rust-lang/rust/issues/138227>
#![expect(incomplete_features)]
#![feature(min_generic_const_args)]
#![feature(inherent_associated_types)]
#![allow(dead_code)]

struct Foo<A, B>(A, B);
impl<A, B> Foo<A, B> {
    #[type_const]
    const VALUE: usize = 4;

    fn foo() {
        let _ = [5; Self::VALUE];
    }
}

struct Bar<const N: usize>;
impl<const N: usize> Bar<N> {
    #[type_const]
    const VALUE: usize = 4;

    fn bar() {
        let _ = [0; Self::VALUE];
    }
}

fn main() {}
Backtrace

error: internal compiler error: compiler\rustc_middle\src\ty\context.rs:2982:17: args not compatible with generics for Foo::<A, B>::VALUE: args=[
                                    Foo<A/#0, B/#1>,
                                ], generics=[
                                    A/#0,
                                    B/#1,
                                ]


thread 'rustc' (12784) panicked at compiler\rustc_middle\src\ty\context.rs:2982:17:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic<rustc_errors::ExplicitBug>
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\panicking.rs:761
   1: std::panic::panic_any<rustc_errors::ExplicitBug>
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\panic.rs:260
   2: rustc_errors::diagnostic::impl$2::emit_producing_guarantee
             at .\compiler\rustc_errors\src\diagnostic.rs:63
   3: rustc_errors::diagnostic::Diag::emit<rustc_errors::diagnostic::BugAbort>
             at .\compiler\rustc_errors\src\diagnostic.rs:1405
   4: rustc_errors::DiagCtxtHandle::bug<alloc::string::String>
             at .\compiler\rustc_errors\src\lib.rs:1231
   5: rustc_middle::util::bug::opt_span_bug_fmt::closure$0<rustc_span::span_encoding::Span>
             at .\compiler\rustc_middle\src\util\bug.rs:39
   6: rustc_middle::ty::context::tls::with_opt::closure$0<rustc_middle::util::bug::opt_span_bug_fmt::closure_env$0<rustc_span::span_encoding::Span>,never$>
             at .\compiler\rustc_middle\src\ty\context\tls.rs:136
   7: rustc_middle::ty::context::tls::with_context_opt<rustc_middle::ty::context::tls::with_opt::closure_env$0<rustc_middle::util::bug::opt_span_bug_fmt::closure_env$0<rustc_span::span_encoding::Span>,never$>,never$>
             at .\compiler\rustc_middle\src\ty\context\tls.rs:79
   8: rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt::closure_env$0<rustc_span::span_encoding::Span>,never$>
             at .\compiler\rustc_middle\src\ty\context\tls.rs:134
   9: rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>
             at .\compiler\rustc_middle\src\util\bug.rs:33
  10: rustc_middle::util::bug::bug_fmt
             at .\compiler\rustc_middle\src\util\bug.rs:16
  11: rustc_middle::ty::context::TyCtxt::debug_assert_args_compatible
             at .\compiler\rustc_middle\src\macros.rs:18
  12: rustc_hir_analysis::hir_ty_lowering::impl$5::lower_type_relative_const_path
             at .\compiler\rustc_hir_analysis\src\hir_ty_lowering\mod.rs:1397
  13: rustc_hir_analysis::hir_ty_lowering::impl$5::lower_const_arg
             at .\compiler\rustc_hir_analysis\src\hir_ty_lowering\mod.rs:2377
  14: rustc_hir_typeck::fn_ctxt::FnCtxt::lower_const_arg
             at .\compiler\rustc_hir_typeck\src\fn_ctxt\_impl.rs:530
  15: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_repeat
             at .\compiler\rustc_hir_typeck\src\expr.rs:1752
  16: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_kind
             at .\compiler\rustc_hir_typeck\src\expr.rs:407
  17: rustc_hir_typeck::expr::impl$0::check_expr_with_expectation_and_args::closure$0
             at .\compiler\rustc_hir_typeck\src\expr.rs:291
  18: stacker::maybe_grow
             at C:\Users\User\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stacker-0.1.21\src\lib.rs:57
  19: rustc_data_structures::stack::ensure_sufficient_stack
             at .\compiler\rustc_data_structures\src\stack.rs:21
  20: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_with_expectation_and_args
             at .\compiler\rustc_hir_typeck\src\expr.rs:286
  21: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_with_expectation
             at .\compiler\rustc_hir_typeck\src\expr.rs:231
  22: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_coercible_to_type_or_error<rustc_hir_typeck::expr::impl$0::check_expr_coercible_to_type::closure_env$0>
             at .\compiler\rustc_hir_typeck\src\expr.rs:162
  23: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_coercible_to_type
             at .\compiler\rustc_hir_typeck\src\expr.rs:152
  24: rustc_hir_typeck::fn_ctxt::FnCtxt::check_decl_initializer
             at .\compiler\rustc_hir_typeck\src\fn_ctxt\checks.rs:897
  25: rustc_hir_typeck::fn_ctxt::FnCtxt::check_decl
             at .\compiler\rustc_hir_typeck\src\fn_ctxt\checks.rs:907
  26: rustc_hir_typeck::fn_ctxt::FnCtxt::check_decl_local
             at .\compiler\rustc_hir_typeck\src\fn_ctxt\checks.rs:942
  27: rustc_hir_typeck::fn_ctxt::FnCtxt::check_stmt
             at .\compiler\rustc_hir_typeck\src\fn_ctxt\checks.rs:966
  28: rustc_hir_typeck::fn_ctxt::checks::impl$0::check_expr_block::closure$0
             at .\compiler\rustc_hir_typeck\src\fn_ctxt\checks.rs:1043
  29: rustc_hir_typeck::fn_ctxt::FnCtxt::with_breakable_ctxt<rustc_hir_typeck::fn_ctxt::checks::impl$0::check_expr_block::closure_env$0,tuple$<> >
             at .\compiler\rustc_hir_typeck\src\fn_ctxt\_impl.rs:1489
  30: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_block
             at .\compiler\rustc_hir_typeck\src\fn_ctxt\checks.rs:1041
  31: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_kind
             at .\compiler\rustc_hir_typeck\src\expr.rs:387
  32: rustc_hir_typeck::expr::impl$0::check_expr_with_expectation_and_args::closure$0
             at .\compiler\rustc_hir_typeck\src\expr.rs:291
  33: stacker::maybe_grow
             at C:\Users\User\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stacker-0.1.21\src\lib.rs:57
  34: rustc_data_structures::stack::ensure_sufficient_stack
             at .\compiler\rustc_data_structures\src\stack.rs:21
  35: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_with_expectation_and_args
             at .\compiler\rustc_hir_typeck\src\expr.rs:286
  36: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_with_expectation
             at .\compiler\rustc_hir_typeck\src\expr.rs:231
  37: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_with_hint
             at .\compiler\rustc_hir_typeck\src\expr.rs:186
  38: rustc_hir_typeck::fn_ctxt::FnCtxt::check_return_or_body_tail
             at .\compiler\rustc_hir_typeck\src\expr.rs:977
  39: rustc_hir_typeck::check::check_fn
             at .\compiler\rustc_hir_typeck\src\check.rs:130
  40: rustc_hir_typeck::typeck_with_inspect::closure$0
             at .\compiler\rustc_hir_typeck\src\lib.rs:180
  41: rustc_hir_typeck::typeck_with_inspect
             at .\compiler\rustc_hir_typeck\src\lib.rs:105
  42: rustc_query_impl::query_impl::typeck::dynamic_query::closure$2::closure$0
             at .\compiler\rustc_query_impl\src\plumbing.rs:298
      [... omitted 18 frames ...]
  43: rustc_middle::query::inner::query_ensure
             at .\compiler\rustc_middle\src\query\inner.rs:51
  44: rustc_middle::query::plumbing::TyCtxtEnsureOk::typeck
             at .\compiler\rustc_middle\src\query\plumbing.rs:173
  45: rustc_hir_analysis::check_crate::closure$2
             at .\compiler\rustc_hir_analysis\src\lib.rs:256
  46: rustc_middle::hir::map::impl$3::par_hir_body_owners::closure$0<rustc_hir_analysis::check_crate::closure_env$2>
             at .\compiler\rustc_middle\src\hir\map.rs:339
  47: rustc_data_structures::sync::parallel::par_for_each_in::closure$0::closure$1::closure$0
             at .\compiler\rustc_data_structures\src\sync\parallel.rs:181
  48: core::panic::unwind_safe::impl$25::call_once
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\core\src\panic\unwind_safe.rs:274
  49: std::panicking::catch_unwind::do_call
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\panicking.rs:581
  50: std::panicking::catch_unwind
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\panicking.rs:544
  51: std::panic::catch_unwind
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\panic.rs:359
  52: rustc_data_structures::sync::parallel::ParallelGuard::run
             at .\compiler\rustc_data_structures\src\sync\parallel.rs:23
  53: rustc_data_structures::sync::parallel::par_for_each_in::closure$0::closure$1
             at .\compiler\rustc_data_structures\src\sync\parallel.rs:181
  54: core::slice::iter::impl$166::for_each
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\core\src\slice\iter\macros.rs:301
  55: rustc_data_structures::sync::parallel::par_for_each_in::closure$0
             at .\compiler\rustc_data_structures\src\sync\parallel.rs:180
  56: rustc_data_structures::sync::parallel::parallel_guard
             at .\compiler\rustc_data_structures\src\sync\parallel.rs:39
  57: rustc_data_structures::sync::parallel::par_for_each_in<ref$<rustc_span::def_id::LocalDefId>,ref$<slice2$<rustc_span::def_id::LocalDefId> >,rustc_middle::hir::map::impl$3::par_hir_body_owners::closure_env$0<rustc_hir_analysis::check_crate::closure_env$2> >
             at .\compiler\rustc_data_structures\src\sync\parallel.rs:175
  58: rustc_middle::ty::context::TyCtxt::par_hir_body_owners
             at .\compiler\rustc_middle\src\hir\map.rs:339
  59: rustc_hir_analysis::check_crate
             at .\compiler\rustc_hir_analysis\src\lib.rs:231
  60: rustc_interface::passes::run_required_analyses
             at .\compiler\rustc_interface\src\passes.rs:1088
  61: rustc_interface::passes::analysis
             at .\compiler\rustc_interface\src\passes.rs:1144
  62: rustc_query_impl::query_impl::analysis::dynamic_query::closure$2::closure$0
             at .\compiler\rustc_query_impl\src\plumbing.rs:298
      [... omitted 18 frames ...]
  63: rustc_middle::query::inner::query_ensure
             at .\compiler\rustc_middle\src\query\inner.rs:51
  64: rustc_middle::query::plumbing::TyCtxtEnsureOk::analysis
             at .\compiler\rustc_middle\src\query\plumbing.rs:173
  65: rustc_driver_impl::run_compiler::closure$0::closure$2
             at .\compiler\rustc_driver_impl\src\lib.rs:367
  66: rustc_interface::passes::create_and_enter_global_ctxt::closure$2::closure$0
             at .\compiler\rustc_interface\src\passes.rs:1020
  67: rustc_middle::ty::context::impl$20::enter::closure$1
             at .\compiler\rustc_middle\src\ty\context.rs:1648
  68: rustc_middle::ty::context::tls::enter_context::closure$0
             at .\compiler\rustc_middle\src\ty\context\tls.rs:60
  69: std::thread::local::LocalKey::try_with
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\thread\local.rs:513
  70: std::thread::local::LocalKey::with<core::cell::Cell<ptr_const$<tuple$<> > >,rustc_middle::ty::context::tls::enter_context::closure_env$0<rustc_middle::ty::context::impl$20::enter::closure_env$1<rustc_interface::passes::create_and_enter_global_ctxt::closure
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\thread\local.rs:477
  71: rustc_middle::ty::context::tls::enter_context
             at .\compiler\rustc_middle\src\ty\context\tls.rs:57
  72: rustc_middle::ty::context::GlobalCtxt::enter
             at .\compiler\rustc_middle\src\ty\context.rs:1648
  73: rustc_middle::ty::context::TyCtxt::create_global_ctxt<enum2$<core::option::Option<rustc_interface::queries::Linker> >,rustc_interface::passes::create_and_enter_global_ctxt::closure$2::closure_env$0<enum2$<core::option::Option<rustc_interface::queries::Link
             at .\compiler\rustc_middle\src\ty\context.rs:1855
  74: rustc_interface::passes::create_and_enter_global_ctxt::closure$2
             at .\compiler\rustc_interface\src\passes.rs:987
  75: core::ops::function::FnOnce::call_once<rustc_interface::passes::create_and_enter_global_ctxt::closure_env$2<enum2$<core::option::Option<rustc_interface::queries::Linker> >,rustc_driver_impl::run_compiler::closure$0::closure_env$2>,tuple$<ref$<rustc_session
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\core\src\ops\function.rs:250
  76: alloc::boxed::impl$31::call_once<tuple$<ref$<rustc_session::session::Session>,rustc_middle::ty::context::CurrentGcx,alloc::sync::Arc<rustc_data_structures::jobserver::Proxy,alloc::alloc::Global>,ref$<std::sync::once_lock::OnceLock<rustc_middle::ty::context
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\alloc\src\boxed.rs:2206
  77: rustc_interface::passes::create_and_enter_global_ctxt<enum2$<core::option::Option<rustc_interface::queries::Linker> >,rustc_driver_impl::run_compiler::closure$0::closure_env$2>
             at .\compiler\rustc_interface\src\passes.rs:1028
  78: rustc_driver_impl::run_compiler::closure$0
             at .\compiler\rustc_driver_impl\src\lib.rs:340
  79: rustc_interface::interface::run_compiler::closure$1::closure$0
             at .\compiler\rustc_interface\src\interface.rs:551
  80: core::panic::unwind_safe::impl$25::call_once
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\core\src\panic\unwind_safe.rs:274
  81: std::panicking::catch_unwind::do_call
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\panicking.rs:581
  82: std::panicking::catch_unwind
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\panicking.rs:544
  83: std::panic::catch_unwind
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\panic.rs:359
  84: rustc_interface::interface::run_compiler::closure$1
             at .\compiler\rustc_interface\src\interface.rs:551
  85: rustc_interface::util::run_in_thread_pool_with_globals::closure$0
             at .\compiler\rustc_interface\src\util.rs:209
  86: rustc_interface::util::run_in_thread_with_globals::closure$0::closure$0::closure$0
             at .\compiler\rustc_interface\src\util.rs:163
  87: scoped_tls::ScopedKey::set<rustc_span::SessionGlobals,rustc_interface::util::run_in_thread_with_globals::closure$0::closure$0::closure_env$0<rustc_interface::util::run_in_thread_pool_with_globals::closure_env$0<rustc_interface::interface::run_compiler::clo
             at C:\Users\User\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\scoped-tls-1.0.1\src\lib.rs:137
  88: rustc_span::create_session_globals_then<tuple$<>,rustc_interface::util::run_in_thread_with_globals::closure$0::closure$0::closure_env$0<rustc_interface::util::run_in_thread_pool_with_globals::closure_env$0<rustc_interface::interface::run_compiler::closure_
             at .\compiler\rustc_span\src\lib.rs:144
  89: rustc_interface::util::run_in_thread_with_globals::closure$0::closure$0
             at .\compiler\rustc_interface\src\util.rs:159
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.94.0-dev running on x86_64-pc-windows-msvc

note: compiler flags: -Z threads=1 -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=C:\Users\User\.cargo -Z ignore-directory-in-diagnostics-source-blocks=C:\Users\User\RustroverProjects\rust\vendor -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -C rpath -C debuginfo=0

query stack during panic:
#0 [typeck] type-checking `<impl at C:\Users\User\RustroverProjects\rust\tests\ui\const-generics\mgca\tmp.rs:9:1: 9:21>::foo`
#1 [analysis] running analysis passes on crate `tmp`
end of query stack
error: internal compiler error: compiler\rustc_middle\src\ty\context.rs:2982:17: args not compatible with generics for Bar::<N>::VALUE: args=[
                                    Bar<N/#0>,
                                ], generics=[
                                    N/#0,
                                ]


thread 'rustc' (12784) panicked at compiler\rustc_middle\src\ty\context.rs:2982:17:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic<rustc_errors::ExplicitBug>
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\panicking.rs:761
   1: std::panic::panic_any<rustc_errors::ExplicitBug>
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\panic.rs:260
   2: rustc_errors::diagnostic::impl$2::emit_producing_guarantee
             at .\compiler\rustc_errors\src\diagnostic.rs:63
   3: rustc_errors::diagnostic::Diag::emit<rustc_errors::diagnostic::BugAbort>
             at .\compiler\rustc_errors\src\diagnostic.rs:1405
   4: rustc_errors::DiagCtxtHandle::bug<alloc::string::String>
             at .\compiler\rustc_errors\src\lib.rs:1231
   5: rustc_middle::util::bug::opt_span_bug_fmt::closure$0<rustc_span::span_encoding::Span>
             at .\compiler\rustc_middle\src\util\bug.rs:39
   6: rustc_middle::ty::context::tls::with_opt::closure$0<rustc_middle::util::bug::opt_span_bug_fmt::closure_env$0<rustc_span::span_encoding::Span>,never$>
             at .\compiler\rustc_middle\src\ty\context\tls.rs:136
   7: rustc_middle::ty::context::tls::with_context_opt<rustc_middle::ty::context::tls::with_opt::closure_env$0<rustc_middle::util::bug::opt_span_bug_fmt::closure_env$0<rustc_span::span_encoding::Span>,never$>,never$>
             at .\compiler\rustc_middle\src\ty\context\tls.rs:79
   8: rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt::closure_env$0<rustc_span::span_encoding::Span>,never$>
             at .\compiler\rustc_middle\src\ty\context\tls.rs:134
   9: rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>
             at .\compiler\rustc_middle\src\util\bug.rs:33
  10: rustc_middle::util::bug::bug_fmt
             at .\compiler\rustc_middle\src\util\bug.rs:16
  11: rustc_middle::ty::context::TyCtxt::debug_assert_args_compatible
             at .\compiler\rustc_middle\src\macros.rs:18
  12: rustc_hir_analysis::hir_ty_lowering::impl$5::lower_type_relative_const_path
             at .\compiler\rustc_hir_analysis\src\hir_ty_lowering\mod.rs:1397
  13: rustc_hir_analysis::hir_ty_lowering::impl$5::lower_const_arg
             at .\compiler\rustc_hir_analysis\src\hir_ty_lowering\mod.rs:2377
  14: rustc_hir_typeck::fn_ctxt::FnCtxt::lower_const_arg
             at .\compiler\rustc_hir_typeck\src\fn_ctxt\_impl.rs:530
  15: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_repeat
             at .\compiler\rustc_hir_typeck\src\expr.rs:1752
  16: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_kind
             at .\compiler\rustc_hir_typeck\src\expr.rs:407
  17: rustc_hir_typeck::expr::impl$0::check_expr_with_expectation_and_args::closure$0
             at .\compiler\rustc_hir_typeck\src\expr.rs:291
  18: stacker::maybe_grow
             at C:\Users\User\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stacker-0.1.21\src\lib.rs:57
  19: rustc_data_structures::stack::ensure_sufficient_stack
             at .\compiler\rustc_data_structures\src\stack.rs:21
  20: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_with_expectation_and_args
             at .\compiler\rustc_hir_typeck\src\expr.rs:286
  21: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_with_expectation
             at .\compiler\rustc_hir_typeck\src\expr.rs:231
  22: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_coercible_to_type_or_error<rustc_hir_typeck::expr::impl$0::check_expr_coercible_to_type::closure_env$0>
             at .\compiler\rustc_hir_typeck\src\expr.rs:162
  23: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_coercible_to_type
             at .\compiler\rustc_hir_typeck\src\expr.rs:152
  24: rustc_hir_typeck::fn_ctxt::FnCtxt::check_decl_initializer
             at .\compiler\rustc_hir_typeck\src\fn_ctxt\checks.rs:897
  25: rustc_hir_typeck::fn_ctxt::FnCtxt::check_decl
             at .\compiler\rustc_hir_typeck\src\fn_ctxt\checks.rs:907
  26: rustc_hir_typeck::fn_ctxt::FnCtxt::check_decl_local
             at .\compiler\rustc_hir_typeck\src\fn_ctxt\checks.rs:942
  27: rustc_hir_typeck::fn_ctxt::FnCtxt::check_stmt
             at .\compiler\rustc_hir_typeck\src\fn_ctxt\checks.rs:966
  28: rustc_hir_typeck::fn_ctxt::checks::impl$0::check_expr_block::closure$0
             at .\compiler\rustc_hir_typeck\src\fn_ctxt\checks.rs:1043
  29: rustc_hir_typeck::fn_ctxt::FnCtxt::with_breakable_ctxt<rustc_hir_typeck::fn_ctxt::checks::impl$0::check_expr_block::closure_env$0,tuple$<> >
             at .\compiler\rustc_hir_typeck\src\fn_ctxt\_impl.rs:1489
  30: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_block
             at .\compiler\rustc_hir_typeck\src\fn_ctxt\checks.rs:1041
  31: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_kind
             at .\compiler\rustc_hir_typeck\src\expr.rs:387
  32: rustc_hir_typeck::expr::impl$0::check_expr_with_expectation_and_args::closure$0
             at .\compiler\rustc_hir_typeck\src\expr.rs:291
  33: stacker::maybe_grow
             at C:\Users\User\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stacker-0.1.21\src\lib.rs:57
  34: rustc_data_structures::stack::ensure_sufficient_stack
             at .\compiler\rustc_data_structures\src\stack.rs:21
  35: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_with_expectation_and_args
             at .\compiler\rustc_hir_typeck\src\expr.rs:286
  36: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_with_expectation
             at .\compiler\rustc_hir_typeck\src\expr.rs:231
  37: rustc_hir_typeck::fn_ctxt::FnCtxt::check_expr_with_hint
             at .\compiler\rustc_hir_typeck\src\expr.rs:186
  38: rustc_hir_typeck::fn_ctxt::FnCtxt::check_return_or_body_tail
             at .\compiler\rustc_hir_typeck\src\expr.rs:977
  39: rustc_hir_typeck::check::check_fn
             at .\compiler\rustc_hir_typeck\src\check.rs:130
  40: rustc_hir_typeck::typeck_with_inspect::closure$0
             at .\compiler\rustc_hir_typeck\src\lib.rs:180
  41: rustc_hir_typeck::typeck_with_inspect
             at .\compiler\rustc_hir_typeck\src\lib.rs:105
  42: rustc_query_impl::query_impl::typeck::dynamic_query::closure$2::closure$0
             at .\compiler\rustc_query_impl\src\plumbing.rs:298
      [... omitted 18 frames ...]
  43: rustc_middle::query::inner::query_ensure
             at .\compiler\rustc_middle\src\query\inner.rs:51
  44: rustc_middle::query::plumbing::TyCtxtEnsureOk::typeck
             at .\compiler\rustc_middle\src\query\plumbing.rs:173
  45: rustc_hir_analysis::check_crate::closure$2
             at .\compiler\rustc_hir_analysis\src\lib.rs:256
  46: rustc_middle::hir::map::impl$3::par_hir_body_owners::closure$0<rustc_hir_analysis::check_crate::closure_env$2>
             at .\compiler\rustc_middle\src\hir\map.rs:339
  47: rustc_data_structures::sync::parallel::par_for_each_in::closure$0::closure$1::closure$0
             at .\compiler\rustc_data_structures\src\sync\parallel.rs:181
  48: core::panic::unwind_safe::impl$25::call_once
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\core\src\panic\unwind_safe.rs:274
  49: std::panicking::catch_unwind::do_call
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\panicking.rs:581
  50: std::panicking::catch_unwind
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\panicking.rs:544
  51: std::panic::catch_unwind
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\panic.rs:359
  52: rustc_data_structures::sync::parallel::ParallelGuard::run
             at .\compiler\rustc_data_structures\src\sync\parallel.rs:23
  53: rustc_data_structures::sync::parallel::par_for_each_in::closure$0::closure$1
             at .\compiler\rustc_data_structures\src\sync\parallel.rs:181
  54: core::slice::iter::impl$166::for_each
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\core\src\slice\iter\macros.rs:301
  55: rustc_data_structures::sync::parallel::par_for_each_in::closure$0
             at .\compiler\rustc_data_structures\src\sync\parallel.rs:180
  56: rustc_data_structures::sync::parallel::parallel_guard
             at .\compiler\rustc_data_structures\src\sync\parallel.rs:39
  57: rustc_data_structures::sync::parallel::par_for_each_in<ref$<rustc_span::def_id::LocalDefId>,ref$<slice2$<rustc_span::def_id::LocalDefId> >,rustc_middle::hir::map::impl$3::par_hir_body_owners::closure_env$0<rustc_hir_analysis::check_crate::closure_env$2> >
             at .\compiler\rustc_data_structures\src\sync\parallel.rs:175
  58: rustc_middle::ty::context::TyCtxt::par_hir_body_owners
             at .\compiler\rustc_middle\src\hir\map.rs:339
  59: rustc_hir_analysis::check_crate
             at .\compiler\rustc_hir_analysis\src\lib.rs:231
  60: rustc_interface::passes::run_required_analyses
             at .\compiler\rustc_interface\src\passes.rs:1088
  61: rustc_interface::passes::analysis
             at .\compiler\rustc_interface\src\passes.rs:1144
  62: rustc_query_impl::query_impl::analysis::dynamic_query::closure$2::closure$0
             at .\compiler\rustc_query_impl\src\plumbing.rs:298
      [... omitted 18 frames ...]
  63: rustc_middle::query::inner::query_ensure
             at .\compiler\rustc_middle\src\query\inner.rs:51
  64: rustc_middle::query::plumbing::TyCtxtEnsureOk::analysis
             at .\compiler\rustc_middle\src\query\plumbing.rs:173
  65: rustc_driver_impl::run_compiler::closure$0::closure$2
             at .\compiler\rustc_driver_impl\src\lib.rs:367
  66: rustc_interface::passes::create_and_enter_global_ctxt::closure$2::closure$0
             at .\compiler\rustc_interface\src\passes.rs:1020
  67: rustc_middle::ty::context::impl$20::enter::closure$1
             at .\compiler\rustc_middle\src\ty\context.rs:1648
  68: rustc_middle::ty::context::tls::enter_context::closure$0
             at .\compiler\rustc_middle\src\ty\context\tls.rs:60
  69: std::thread::local::LocalKey::try_with
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\thread\local.rs:513
  70: std::thread::local::LocalKey::with<core::cell::Cell<ptr_const$<tuple$<> > >,rustc_middle::ty::context::tls::enter_context::closure_env$0<rustc_middle::ty::context::impl$20::enter::closure_env$1<rustc_interface::passes::create_and_enter_global_ctxt::closure
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\thread\local.rs:477
  71: rustc_middle::ty::context::tls::enter_context
             at .\compiler\rustc_middle\src\ty\context\tls.rs:57
  72: rustc_middle::ty::context::GlobalCtxt::enter
             at .\compiler\rustc_middle\src\ty\context.rs:1648
  73: rustc_middle::ty::context::TyCtxt::create_global_ctxt<enum2$<core::option::Option<rustc_interface::queries::Linker> >,rustc_interface::passes::create_and_enter_global_ctxt::closure$2::closure_env$0<enum2$<core::option::Option<rustc_interface::queries::Link
             at .\compiler\rustc_middle\src\ty\context.rs:1855
  74: rustc_interface::passes::create_and_enter_global_ctxt::closure$2
             at .\compiler\rustc_interface\src\passes.rs:987
  75: core::ops::function::FnOnce::call_once<rustc_interface::passes::create_and_enter_global_ctxt::closure_env$2<enum2$<core::option::Option<rustc_interface::queries::Linker> >,rustc_driver_impl::run_compiler::closure$0::closure_env$2>,tuple$<ref$<rustc_session
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\core\src\ops\function.rs:250
  76: alloc::boxed::impl$31::call_once<tuple$<ref$<rustc_session::session::Session>,rustc_middle::ty::context::CurrentGcx,alloc::sync::Arc<rustc_data_structures::jobserver::Proxy,alloc::alloc::Global>,ref$<std::sync::once_lock::OnceLock<rustc_middle::ty::context
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\alloc\src\boxed.rs:2206
  77: rustc_interface::passes::create_and_enter_global_ctxt<enum2$<core::option::Option<rustc_interface::queries::Linker> >,rustc_driver_impl::run_compiler::closure$0::closure_env$2>
             at .\compiler\rustc_interface\src\passes.rs:1028
  78: rustc_driver_impl::run_compiler::closure$0
             at .\compiler\rustc_driver_impl\src\lib.rs:340
  79: rustc_interface::interface::run_compiler::closure$1::closure$0
             at .\compiler\rustc_interface\src\interface.rs:551
  80: core::panic::unwind_safe::impl$25::call_once
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\core\src\panic\unwind_safe.rs:274
  81: std::panicking::catch_unwind::do_call
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\panicking.rs:581
  82: std::panicking::catch_unwind
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\panicking.rs:544
  83: std::panic::catch_unwind
             at /rustc/1b6e21e163baa0b20f119e17e3871910978a60b6\library\std\src\panic.rs:359
  84: rustc_interface::interface::run_compiler::closure$1
             at .\compiler\rustc_interface\src\interface.rs:551
  85: rustc_interface::util::run_in_thread_pool_with_globals::closure$0
             at .\compiler\rustc_interface\src\util.rs:209
  86: rustc_interface::util::run_in_thread_with_globals::closure$0::closure$0::closure$0
             at .\compiler\rustc_interface\src\util.rs:163
  87: scoped_tls::ScopedKey::set<rustc_span::SessionGlobals,rustc_interface::util::run_in_thread_with_globals::closure$0::closure$0::closure_env$0<rustc_interface::util::run_in_thread_pool_with_globals::closure_env$0<rustc_interface::interface::run_compiler::clo
             at C:\Users\User\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\scoped-tls-1.0.1\src\lib.rs:137
  88: rustc_span::create_session_globals_then<tuple$<>,rustc_interface::util::run_in_thread_with_globals::closure$0::closure$0::closure_env$0<rustc_interface::util::run_in_thread_pool_with_globals::closure_env$0<rustc_interface::interface::run_compiler::closure_
             at .\compiler\rustc_span\src\lib.rs:144
  89: rustc_interface::util::run_in_thread_with_globals::closure$0::closure$0
             at .\compiler\rustc_interface\src\util.rs:159
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.94.0-dev running on x86_64-pc-windows-msvc

note: compiler flags: -Z threads=1 -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=C:\Users\User\.cargo -Z ignore-directory-in-diagnostics-source-blocks=C:\Users\User\RustroverProjects\rust\vendor -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -C rpath -C debuginfo=0

query stack during panic:
#0 [typeck] type-checking `<impl at C:\Users\Redddy\zed\rust\tests\ui\const-generics\mgca\tmp.rs:19:1: 19:28>::bar`
#1 [analysis] running analysis passes on crate `tmp`
end of query stack
error: aborting due to 2 previous errors

@reddevilmidzy
Copy link
Member Author

It seems like it wasn't reflected in playground nightly because it was a very recent work.

@Kivooeo
Copy link
Member

Kivooeo commented Jan 10, 2026

It seems like it wasn't reflected in playground nightly because it was a very recent work.

Seems like it, would be nice if you could bisect it (I would be able to do this myself, but only little bit later)

@reddevilmidzy
Copy link
Member Author

Seems like it, would be nice if you could bisect it (I would be able to do this myself, but only little bit later)

Failed to find with bisect rustc, I'll wait a bit and try again.

cargo bisect-rustc --start=2026-01-09 --end=2026-01-10 --regress=ice
checking the start range to find a passing nightly
installing nightly-2026-01-09
rust-std-nightly-x86_64-pc-windows-msvc: 21.22 MB / 21.22 MB [=============================================================================] 100.00 % 8.30 MB/s testing...
RESULT: nightly-2026-01-09, ===> Did not ICE
uninstalling nightly-2026-01-09

checking the end range to verify it does not pass
installing nightly-2026-01-10
testing...
RESULT: nightly-2026-01-10, ===> Did not ICE
uninstalling nightly-2026-01-10

ERROR: the end of the range (nightly-2026-01-10) does not reproduce the regression

@rustbot
Copy link
Collaborator

rustbot commented Jan 11, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Jan 11, 2026

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

@reddevilmidzy reddevilmidzy changed the title Added mGCA tests that were resolved Added mGCA related tests Jan 11, 2026
@rust-log-analyzer

This comment has been minimized.

@reddevilmidzy
Copy link
Member Author

I don't know why ICE occurred when the test code was in tests/ui, but when I moved it to tests/crashes, ICE didn't occur.
All tests/crashes tests locally were successful.

image

@rust-log-analyzer

This comment has been minimized.

@reddevilmidzy
Copy link
Member Author

Added tests for five resolved issues and four crash tests.
Tests 138226 and 138226-2 appear to require debug assertions.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 12, 2026
@reddevilmidzy
Copy link
Member Author

I guessed it was related to debug assert since ICE is reproduced in rustc 1.94.0-dev but not in rustc 1.94.0-nightly.
So first I used bisect to find out when ICE disappeared and it pointed to 2025-05-05-nightly.
Since it's been over 167 days, I couldn't build for each specific commit.

So, to verify that the ICE currently occurring in rustc-dev was indeed eliminated in nightly-2025-05-05, I checked out the last commit from 2025-05-05 and ran ./x test, but this also failed because it couldn't fetch ci-artifacts.

@@ -0,0 +1,14 @@
//! regression test for <https://github.com/rust-lang/rust/issues/143506>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are still ways to reproduce this ICE unfortunately, can you remove this test.

#![feature(min_generic_const_args)]

fn foo<T>() {
[0; size_of::<*mut T>()];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a second line for [0; const { size_of::<*mut T>() }]

@@ -0,0 +1,11 @@
//! regression test for <https://github.com/rust-lang/rust/issues/143358>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this bug was only ever reproducible via generic_const_exprs as it relied on anon consts inheriting generics from parent defs (and then those parent defs being broken defids from mGCA).

cc #148843

I would prefer to remove this test but still close the issue as I don't think we get much value from having more test coverage for generic_const_exprs

@@ -0,0 +1,26 @@
//! regression test for <https://github.com/rust-lang/rust/issues/139259>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still ICEs can you remove this test

@reddevilmidzy
Copy link
Member Author

thank you for the review. I've deleted the tests you mentioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

6 participants