Skip to content

[ICE]: rustc panicked at compiler\rustc_mir_build\src\builder\matches\mod.rs:2176:44 #151595

@sososopy

Description

@sososopy

The code is generated by a fuzzer and reduced manually

Code

//compile-flags: rustc --edition 2024
#![feature(type_alias_impl_trait)]
fn func() {
    type T = impl Copy;
    let foo: T = Some((1u32, 1u32));
    let x = move || match foo {
        None => (),
        Some((a, b)) => (),
    };
}
fn main() {}

Meta

rustc --version --verbose:

rustc 1.95.0-nightly (d222ddc4d 2026-01-23)
binary: rustc
commit-hash: d222ddc4d90743dfc1e53b610be8fc9d95893d2c
commit-date: 2026-01-23
host: x86_64-pc-windows-msvc
release: 1.95.0-nightly
LLVM version: 21.1.8

Error output

<output>
Backtrace

thread 'rustc' panicked at /rustc-dev/d222ddc4d90743dfc1e53b610be8fc9d95893d2c/compiler\rustc_mir_build\src\builder\matches\mod.rs:2176:44:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7ffb1c14b38e - std::backtrace_rs::backtrace::win64::trace
                               at /rustc/d222ddc4d90743dfc1e53b610be8fc9d95893d2c/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
   1:     0x7ffb1c14b38e - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/d222ddc4d90743dfc1e53b610be8fc9d95893d2c/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffb1c14b38e - std::backtrace::Backtrace::create
                               at /rustc/d222ddc4d90743dfc1e53b610be8fc9d95893d2c/library\std\src\backtrace.rs:331
   3:     0x7ffb1c14b2ca - std::backtrace::Backtrace::force_capture
                               at /rustc/d222ddc4d90743dfc1e53b610be8fc9d95893d2c/library\std\src\backtrace.rs:312
   4:     0x7ffb1d90d982 - core[47517f30b10889c7]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[fcf8ff5ae6779304]::Level, &str), usize), <((rustc_lint_defs[fcf8ff5ae6779304]::Level, &str), usize) as core[47517f30b10889c7]::cmp::PartialOrd>::lt>
   5:     0x7ffb1c15eea1 - std::panicking::panic_with_hook
                               at /rustc/d222ddc4d90743dfc1e53b610be8fc9d95893d2c/library\std\src\panicking.rs:833
   6:     0x7ffb1c1445d9 - std::panicking::panic_handler::closure$0
                               at /rustc/d222ddc4d90743dfc1e53b610be8fc9d95893d2c/library\std\src\panicking.rs:691
   7:     0x7ffb1c1418df - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::panic_handler::closure_env$0,never$>
                               at /rustc/d222ddc4d90743dfc1e53b610be8fc9d95893d2c/library\std\src\sys\backtrace.rs:182
   8:     0x7ffb1c14515e - std::panicking::panic_handler
                               at /rustc/d222ddc4d90743dfc1e53b610be8fc9d95893d2c/library\std\src\panicking.rs:689
   9:     0x7ffb2037174d - core::panicking::panic_fmt
                               at /rustc/d222ddc4d90743dfc1e53b610be8fc9d95893d2c/library\core\src\panicking.rs:80
  10:     0x7ffb20371717 - core::panicking::panic
                               at /rustc/d222ddc4d90743dfc1e53b610be8fc9d95893d2c/library\core\src\panicking.rs:150
  11:     0x7ffb2037138e - core::option::unwrap_failed
                               at /rustc/d222ddc4d90743dfc1e53b610be8fc9d95893d2c/library\core\src\option.rs:2193
  12:     0x7ffb1c7fd2ce - core[47517f30b10889c7]::slice::sort::stable::quicksort::quicksort::<(rustc_mir_build[a78281611376c7cd]::builder::scope::DropIdx, rustc_middle[d070e47d488fbf98]::mir::BasicBlock), <(rustc_mir_build[a78281611376c7cd]::builder::scope::DropIdx, rustc_middle[d070e47d488fbf98]::mir::BasicBlock) as core[47517f30b10889c7]::cmp::PartialOrd>::lt>
  13:     0x7ffb1c84f472 - <alloc[19ad1bd9461ed7b8]::raw_vec::RawVec<ena[b3043867075a27b0]::unify::VarValue<rustc_infer[1e53b34edc8e67ae]::infer::type_variable::TyVidSubKey>>>::grow_one
  14:     0x7ffb1c828714 - core[47517f30b10889c7]::slice::sort::stable::quicksort::quicksort::<(rustc_mir_build[a78281611376c7cd]::builder::scope::DropIdx, rustc_middle[d070e47d488fbf98]::mir::BasicBlock), <(rustc_mir_build[a78281611376c7cd]::builder::scope::DropIdx, rustc_middle[d070e47d488fbf98]::mir::BasicBlock) as core[47517f30b10889c7]::cmp::PartialOrd>::lt>
  15:     0x7ffb1c826c8e - core[47517f30b10889c7]::slice::sort::stable::quicksort::quicksort::<(rustc_mir_build[a78281611376c7cd]::builder::scope::DropIdx, rustc_middle[d070e47d488fbf98]::mir::BasicBlock), <(rustc_mir_build[a78281611376c7cd]::builder::scope::DropIdx, rustc_middle[d070e47d488fbf98]::mir::BasicBlock) as core[47517f30b10889c7]::cmp::PartialOrd>::lt>
  16:     0x7ffb1c86120e - rustc_mir_build[a78281611376c7cd]::builder::build_mir_inner_impl
  17:     0x7ffb1c66cfc4 - rustc_mir_transform[6cd7bd186c5482be]::mir_built
  18:     0x7ffb1cf8533b - RINvMs6_NtCsbbqP6BDAd6w_9hashbrown3rawINtB6_8RawTableTTNtNtNtCshTwDMUac5Aa_12rustc_middle2ty8instance8InstanceNtNtNtBX_3mir4mono14CollectionModeETINtNtNtBX_5query5erase6ErasedAhj20_ENtNtNtCs34QVAf2vBYO_18rustc_query_system9dep_graph5graph12DepNodeIndexEEE1
  19:     0x7ffb1d018f02 - RINvNtNtCs34QVAf2vBYO_18rustc_query_system5query8plumbing17try_execute_queryINtCsbiVmqBw8rRZ_16rustc_query_impl13DynamicConfigINtNtCsiQLuZhbz1Vm_21rustc_data_structures9vec_cache8VecCacheNtNtCseevRozILHse_10rustc_span6def_id10LocalDefIdINtNtNtCshTwDMUac5Aa
  20:     0x7ffb1d051012 - rustc_query_impl[83addecb657f1821]::plumbing::query_key_hash_verify_all
  21:     0x7ffb1c6b2c67 - rustc_mir_transform[6cd7bd186c5482be]::ffi_unwind_calls::has_ffi_unwind_calls
  22:     0x7ffb1cf83f2b - RINvMs6_NtCsbbqP6BDAd6w_9hashbrown3rawINtB6_8RawTableTTNtNtNtCshTwDMUac5Aa_12rustc_middle2ty8instance8InstanceNtNtNtBX_3mir4mono14CollectionModeETINtNtNtBX_5query5erase6ErasedAhj20_ENtNtNtCs34QVAf2vBYO_18rustc_query_system9dep_graph5graph12DepNodeIndexEEE1
  23:     0x7ffb1d0116ae - RINvNtNtCs34QVAf2vBYO_18rustc_query_system5query8plumbing17try_execute_queryINtCsbiVmqBw8rRZ_16rustc_query_impl13DynamicConfigINtNtCsiQLuZhbz1Vm_21rustc_data_structures9vec_cache8VecCacheNtNtCseevRozILHse_10rustc_span6def_id10LocalDefIdINtNtNtCshTwDMUac5Aa
  24:     0x7ffb1d0495e5 - rustc_query_impl[83addecb657f1821]::plumbing::query_key_hash_verify_all
  25:     0x7ffb1c658c3c - rustc_mir_transform[6cd7bd186c5482be]::mir_promoted
  26:     0x7ffb1cf82bb9 - RINvMs6_NtCsbbqP6BDAd6w_9hashbrown3rawINtB6_8RawTableTTNtNtNtCshTwDMUac5Aa_12rustc_middle2ty8instance8InstanceNtNtNtBX_3mir4mono14CollectionModeETINtNtNtBX_5query5erase6ErasedAhj20_ENtNtNtCs34QVAf2vBYO_18rustc_query_system9dep_graph5graph12DepNodeIndexEEE1
  27:     0x7ffb1d00e4c4 - RINvNtNtCs34QVAf2vBYO_18rustc_query_system5query8plumbing17try_execute_queryINtCsbiVmqBw8rRZ_16rustc_query_impl13DynamicConfigINtNtCsiQLuZhbz1Vm_21rustc_data_structures9vec_cache8VecCacheNtNtCseevRozILHse_10rustc_span6def_id10LocalDefIdINtNtNtCshTwDMUac5Aa
  28:     0x7ffb1d041df2 - rustc_query_impl[83addecb657f1821]::plumbing::query_key_hash_verify_all
  29:     0x7ffb1c938799 - rustc_borrowck[b991d4d2c4601714]::mir_borrowck
  30:     0x7ffb1c8dc275 - rustc_borrowck[b991d4d2c4601714]::mir_borrowck
  31:     0x7ffb1cf82b3b - RINvMs6_NtCsbbqP6BDAd6w_9hashbrown3rawINtB6_8RawTableTTNtNtNtCshTwDMUac5Aa_12rustc_middle2ty8instance8InstanceNtNtNtBX_3mir4mono14CollectionModeETINtNtNtBX_5query5erase6ErasedAhj20_ENtNtNtCs34QVAf2vBYO_18rustc_query_system9dep_graph5graph12DepNodeIndexEEE1
  32:     0x7ffb1d018f02 - RINvNtNtCs34QVAf2vBYO_18rustc_query_system5query8plumbing17try_execute_queryINtCsbiVmqBw8rRZ_16rustc_query_impl13DynamicConfigINtNtCsiQLuZhbz1Vm_21rustc_data_structures9vec_cache8VecCacheNtNtCseevRozILHse_10rustc_span6def_id10LocalDefIdINtNtNtCshTwDMUac5Aa
  33:     0x7ffb1d041c02 - rustc_query_impl[83addecb657f1821]::plumbing::query_key_hash_verify_all
  34:     0x7ffb1ec7a45c - <rustc_hir_analysis[71d84e504807816d]::errors::wrong_number_of_generic_args::WrongNumberOfGenericArgs>::get_type_or_const_args_suggestions_from_param_names
  35:     0x7ffb1ecca376 - <rustc_hir_analysis[71d84e504807816d]::check::region::ScopeResolutionVisitor as rustc_hir[2bd8c368e5000b1e]::intravisit::Visitor>::visit_pat
  36:     0x7ffb1b94a949 - rustc_hir_analysis[71d84e504807816d]::check::check_function_signature
  37:     0x7ffb1bbc27bb - <rustc_lint[a85fcfe99b4b7d58]::builtin::SpecialModuleName as rustc_lint[a85fcfe99b4b7d58]::passes::EarlyLintPass>::check_crate
  38:     0x7ffb1cfab980 - RINvNtNtCs34QVAf2vBYO_18rustc_query_system5query8plumbing17try_execute_queryINtCsbiVmqBw8rRZ_16rustc_query_impl13DynamicConfigINtNtB4_6caches10DefIdCacheINtNtNtCshTwDMUac5Aa_12rustc_middle5query5erase6ErasedAhj8_EEKb0_KB3r_KB3r_ENtNtB1f_8plumbing9QueryCtxt
  39:     0x7ffb1bc8c4e4 - rustc_query_impl[83addecb657f1821]::profiling_support::alloc_self_profile_query_strings
  40:     0x7ffb1c571554 - rustc_hir_analysis[71d84e504807816d]::check::check::check_abi
  41:     0x7ffb1cf851b0 - RINvMs6_NtCsbbqP6BDAd6w_9hashbrown3rawINtB6_8RawTableTTNtNtNtCshTwDMUac5Aa_12rustc_middle2ty8instance8InstanceNtNtNtBX_3mir4mono14CollectionModeETINtNtNtBX_5query5erase6ErasedAhj20_ENtNtNtCs34QVAf2vBYO_18rustc_query_system9dep_graph5graph12DepNodeIndexEEE1
  42:     0x7ffb1cfab980 - RINvNtNtCs34QVAf2vBYO_18rustc_query_system5query8plumbing17try_execute_queryINtCsbiVmqBw8rRZ_16rustc_query_impl13DynamicConfigINtNtB4_6caches10DefIdCacheINtNtNtCshTwDMUac5Aa_12rustc_middle5query5erase6ErasedAhj8_EEKb0_KB3r_KB3r_ENtNtB1f_8plumbing9QueryCtxt
  43:     0x7ffb1d04f786 - rustc_query_impl[83addecb657f1821]::plumbing::query_key_hash_verify_all
  44:     0x7ffb1b92cff8 - rustc_hir_analysis[71d84e504807816d]::check::check_function_signature
  45:     0x7ffb1c52f2d2 - rustc_hir_analysis[71d84e504807816d]::hir_ty_lowering::generics::check_generic_arg_count_for_call
  46:     0x7ffb1c5590d0 - rustc_hir_analysis[71d84e504807816d]::check::check::check_abi
  47:     0x7ffb1cf838cb - RINvMs6_NtCsbbqP6BDAd6w_9hashbrown3rawINtB6_8RawTableTTNtNtNtCshTwDMUac5Aa_12rustc_middle2ty8instance8InstanceNtNtNtBX_3mir4mono14CollectionModeETINtNtNtBX_5query5erase6ErasedAhj20_ENtNtNtCs34QVAf2vBYO_18rustc_query_system9dep_graph5graph12DepNodeIndexEEE1
  48:     0x7ffb1d011960 - RINvNtNtCs34QVAf2vBYO_18rustc_query_system5query8plumbing17try_execute_queryINtCsbiVmqBw8rRZ_16rustc_query_impl13DynamicConfigINtNtCsiQLuZhbz1Vm_21rustc_data_structures9vec_cache8VecCacheNtNtCseevRozILHse_10rustc_span6def_id10LocalDefIdINtNtNtCshTwDMUac5Aa
  49:     0x7ffb1d046cf5 - rustc_query_impl[83addecb657f1821]::plumbing::query_key_hash_verify_all
  50:     0x7ffb1b8a88c3 - <rustc_hir_typeck[9f2b58aa68a77ff3]::fn_ctxt::inspect_obligations::NestedObligationsForSelfTy as rustc_trait_selection[bb3db6ffe0d11ab2]::solve::inspect::analyse::ProofTreeVisitor>::visit_goal
  51:     0x7ffb1c552f46 - rustc_hir_analysis[71d84e504807816d]::check::check::check_abi
  52:     0x7ffb1bbc1deb - <rustc_lint[a85fcfe99b4b7d58]::builtin::SpecialModuleName as rustc_lint[a85fcfe99b4b7d58]::passes::EarlyLintPass>::check_crate
  53:     0x7ffb1bbd2ea7 - RINvNtNtCs34QVAf2vBYO_18rustc_query_system5query8plumbing17try_execute_queryINtCsbiVmqBw8rRZ_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCshTwDMUac5Aa_12rustc_middle5query5erase6ErasedAhj1_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
  54:     0x7ffb1bc89573 - rustc_query_impl[83addecb657f1821]::profiling_support::alloc_self_profile_query_strings
  55:     0x7ffb1c4c2010 - rustc_hir_analysis[71d84e504807816d]::check_crate
  56:     0x7ffb1c1c680e - rustc_interface[e16522a1a7e9b39e]::passes::analysis
  57:     0x7ffb1bbc643a - <rustc_lint[a85fcfe99b4b7d58]::builtin::SpecialModuleName as rustc_lint[a85fcfe99b4b7d58]::passes::EarlyLintPass>::check_crate
  58:     0x7ffb1bbcc727 - RINvNtNtCs34QVAf2vBYO_18rustc_query_system5query8plumbing17try_execute_queryINtCsbiVmqBw8rRZ_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCshTwDMUac5Aa_12rustc_middle5query5erase6ErasedAhj0_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
  59:     0x7ffb1bca4e83 - rustc_query_impl[83addecb657f1821]::profiling_support::alloc_self_profile_query_strings
  60:     0x7ffb196dc0bb - std[a643faec29aaf5ef]::sys::backtrace::__rust_begin_short_backtrace::<std[a643faec29aaf5ef]::thread::lifecycle::spawn_unchecked<ctrlc[355c9db8aa988261]::set_handler_inner<rustc_driver_impl[680faa52c20afa81]::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
  61:     0x7ffb196d4f4f - RINvNtNtCseh1I7LLxQdL_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCsjlLTVv95Pas_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCs8VUKmtCNrP1_17rustc_driver_i
  62:     0x7ffb196e11b9 - std[a643faec29aaf5ef]::sys::backtrace::__rust_begin_short_backtrace::<std[a643faec29aaf5ef]::thread::lifecycle::spawn_unchecked<ctrlc[355c9db8aa988261]::set_handler_inner<rustc_driver_impl[680faa52c20afa81]::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
  63:     0x7ffb1c168ec8 - std::sys::thread::windows::impl$0::new::thread_start
                               at /rustc/d222ddc4d90743dfc1e53b610be8fc9d95893d2c/library\std\src\sys\thread\windows.rs:58
  64:     0x7ffba0af7374 - BaseThreadInitThunk
  65:     0x7ffba263cc91 - RtlUserThreadStart


rustc version: 1.95.0-nightly (d222ddc4d 2026-01-23)
platform: x86_64-pc-windows-msvc

query stack during panic:
#0 [mir_built] building MIR for `func::{closure#0}`
#1 [has_ffi_unwind_calls] checking if `func::{closure#0}` contains FFI-unwind calls
#2 [mir_promoted] promoting constants in MIR for `func::{closure#0}`
#3 [mir_borrowck] borrow-checking `func`
#4 [type_of_opaque] computing type of opaque `func::T::{opaque#0}`
#5 [type_of] computing type of `func::T::{opaque#0}`
#6 [check_well_formed] checking that `func::T::{opaque#0}` is well-formed
#7 [check_type_wf] checking that types are well-formed
#8 [analysis] running analysis passes on crate `panic`
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-closuresArea: Closures (`|…| { … }`)A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-patternsRelating to patterns and pattern matchingC-bugCategory: This is a bug.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.T-langRelevant to the language teamT-typesRelevant to the types team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions