rust-lang / rust-lang/rust

Design needed for interaction between pin ergonomics and match ergonomics 2024 (RFC 3627)

Open
#151,789 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-patterns C-discussion F-pin_ergonomics I-ICE needs-triage T-compiler T-lang
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

snippet:

#![feature(ref_pat_eat_one_layer_2024)]
#![feature(pin_ergonomics)]
struct Foo;

fn tuple_tuple_ref_pin_mut_pat_and_pin_mut_of_tuple_mut_of_tuple_pin_mut_ty<'a, T>(
    ((&pin mut x,),): &'a pin mut (&'a mut (&'a Foo,),),
) {
}

Version information

rustc 1.95.0-nightly (1e5065a4d 2026-01-28)
binary: rustc
commit-hash: 1e5065a4d99e0e3ccf1a1719055308e7a20e8f36
commit-date: 2026-01-28
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 22.1.0

Possibly related line of code:
https://github.com/rust-lang/rust/blob/1e5065a4d99e0e3ccf1a1719055308e7a20e8f36/compiler/rustc_pattern_analysis/src/rustc.rs#L474-L486

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

warning: the feature `ref_pat_eat_one_layer_2024` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.fPH37lBeHLY7/rustc_testrunner_tmpdir_reporting.dQ5J2SqxBQ1S/mvce.rs:1:12
  |
1 | #![feature(ref_pat_eat_one_layer_2024)]
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #123076 <https://github.com/rust-lang/rust/issues/123076> for more information
  = note: `#[warn(incomplete_features)]` on by default

warning: the feature `pin_ergonomics` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.fPH37lBeHLY7/rustc_testrunner_tmpdir_reporting.dQ5J2SqxBQ1S/mvce.rs:2:12
  |
2 | #![feature(pin_ergonomics)]
  |            ^^^^^^^^^^^^^^
  |
  = note: see issue #130494 <https://github.com/rust-lang/rust/issues/130494> for more information

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.fPH37lBeHLY7/rustc_testrunner_tmpdir_reporting.dQ5J2SqxBQ1S/mvce.rs:8:2
  |
8 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.fPH37lBeHLY7/rustc_testrunner_tmpdir_reporting.dQ5J2SqxBQ1S/mvce.rs`

error: internal compiler error: /rustc-dev/1e5065a4d99e0e3ccf1a1719055308e7a20e8f36/compiler/rustc_pattern_analysis/src/rustc.rs:480:26: pattern has unexpected type: pat: Deref { pin: Pinned, subpattern: Pat { ty: Foo, span: /tmp/icemaker_global_tempdir.fPH37lBeHLY7/rustc_testrunner_tmpdir_reporting.dQ5J2SqxBQ1S/mvce.rs:6:16: 6:17 (#0), extra: None, kind: Binding { name: "x", mode: BindingMode(No, Not), var: LocalVarId(HirId(DefId(0:5 ~ mvce[d603]::tuple_tuple_ref_pin_mut_pat_and_pin_mut_of_tuple_mut_of_tuple_pin_mut_ty).5)), ty: Foo, subpattern: None, is_primary: true, is_shorthand: false } } }, ty: &'{erased} Foo
 --> /tmp/icemaker_global_tempdir.fPH37lBeHLY7/rustc_testrunner_tmpdir_reporting.dQ5J2SqxBQ1S/mvce.rs:6:7
  |
6 |     ((&pin mut x,),): &'a pin mut (&'a mut (&'a Foo,),),
  |       ^^^^^^^^^^


thread 'rustc' (2683406) panicked at /rustc-dev/1e5065a4d99e0e3ccf1a1719055308e7a20e8f36/compiler/rustc_pattern_analysis/src/rustc.rs:480:26:
Box<dyn Any>
stack backtrace:
   0:     0x7f823a64826b - <<std[d7a9ad9d2397029e]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[5cc72673e270ff3e]::fmt::Display>::fmt
   1:     0x7f823ac0f108 - core[5cc72673e270ff3e]::fmt::write
   2:     0x7f823a65f146 - <std[d7a9ad9d2397029e]::sys::stdio::unix::Stderr as std[d7a9ad9d2397029e]::io::Write>::write_fmt
   3:     0x7f823a61e318 - std[d7a9ad9d2397029e]::panicking::default_hook::{closure#0}
   4:     0x7f823a63b633 - std[d7a9ad9d2397029e]::panicking::default_hook
   5:     0x7f823961ac6d - std[d7a9ad9d2397029e]::panicking::update_hook::<alloc[207d8e8634fd4110]::boxed::Box<rustc_driver_impl[f932d213bb3ade3d]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f823a63b912 - std[d7a9ad9d2397029e]::panicking::panic_with_hook
   7:     0x7f823964f3e1 - std[d7a9ad9d2397029e]::panicking::begin_panic::<rustc_errors[3e39d25ea04ed4bf]::ExplicitBug>::{closure#0}
   8:     0x7f8239648186 - std[d7a9ad9d2397029e]::sys::backtrace::__rust_end_short_backtrace::<std[d7a9ad9d2397029e]::panicking::begin_panic<rustc_errors[3e39d25ea04ed4bf]::ExplicitBug>::{closure#0}, !>
   9:     0x7f8239647efa - std[d7a9ad9d2397029e]::panicking::begin_panic::<rustc_errors[3e39d25ea04ed4bf]::ExplicitBug>
  10:     0x7f823965aa01 - <rustc_errors[3e39d25ea04ed4bf]::diagnostic::BugAbort as rustc_errors[3e39d25ea04ed4bf]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7f8239bdfc0c - <rustc_errors[3e39d25ea04ed4bf]::DiagCtxtHandle>::span_bug::<rustc_span[101d8a10560d0148]::span_encoding::Span, alloc[207d8e8634fd4110]::string::String>
  12:     0x7f8239c08436 - rustc_middle[ae72f8db201c45fb]::util::bug::opt_span_bug_fmt::<rustc_span[101d8a10560d0148]::span_encoding::Span>::{closure#0}
  13:     0x7f8239c085e2 - rustc_middle[ae72f8db201c45fb]::ty::context::tls::with_opt::<rustc_middle[ae72f8db201c45fb]::util::bug::opt_span_bug_fmt<rustc_span[101d8a10560d0148]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7f8239bf9c4b - rustc_middle[ae72f8db201c45fb]::ty::context::tls::with_context_opt::<rustc_middle[ae72f8db201c45fb]::ty::context::tls::with_opt<rustc_middle[ae72f8db201c45fb]::util::bug::opt_span_bug_fmt<rustc_span[101d8a10560d0148]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7f82374a1a88 - rustc_middle[ae72f8db201c45fb]::util::bug::span_bug_fmt::<rustc_span[101d8a10560d0148]::span_encoding::Span>
  16:     0x7f8237b13d86 - <rustc_pattern_analysis[7dd64aeb450fd0d2]::rustc::RustcPatCtxt>::lower_pat
  17:     0x7f8237b132c0 - <rustc_pattern_analysis[7dd64aeb450fd0d2]::rustc::RustcPatCtxt>::lower_pat
  18:     0x7f8237b13140 - <rustc_pattern_analysis[7dd64aeb450fd0d2]::rustc::RustcPatCtxt>::lower_pat
  19:     0x7f8237b132c0 - <rustc_pattern_analysis[7dd64aeb450fd0d2]::rustc::RustcPatCtxt>::lower_pat
  20:     0x7f8237b13140 - <rustc_pattern_analysis[7dd64aeb450fd0d2]::rustc::RustcPatCtxt>::lower_pat
  21:     0x7f823b31d7c0 - rustc_mir_build[caaca64e226810d2]::thir::pattern::check_match::check_match
  22:     0x7f823b31d1db - rustc_query_impl[13bcb7b07dc4d660]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[13bcb7b07dc4d660]::query_impl::check_match::make_query_vtable::{closure#2}::{closure#0}, rustc_middle[ae72f8db201c45fb]::query::erase::Erased<[u8; 1usize]>>
  23:     0x7f823b3d7a52 - rustc_query_system[fda0dd1a18d51465]::query::plumbing::try_execute_query::<rustc_query_impl[13bcb7b07dc4d660]::SemiDynamicQueryDispatcher<rustc_data_structures[c9669210c0b9186b]::vec_cache::VecCache<rustc_span[101d8a10560d0148]::def_id::LocalDefId, rustc_middle[ae72f8db201c45fb]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[fda0dd1a18d51465]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[13bcb7b07dc4d660]::plumbing::QueryCtxt, false>
  24:     0x7f823b3d7711 - rustc_query_impl[13bcb7b07dc4d660]::query_impl::check_match::get_query_non_incr::__rust_end_short_backtrace
  25:     0x7f823b19ea1e - rustc_mir_build[caaca64e226810d2]::builder::build_mir_inner_impl
  26:     0x7f823ac08e6a - rustc_mir_transform[917e19d7d4dd96cc]::mir_built
  27:     0x7f823ac08e25 - rustc_query_impl[13bcb7b07dc4d660]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[13bcb7b07dc4d660]::query_impl::mir_built::make_query_vtable::{closure#2}::{closure#0}, rustc_middle[ae72f8db201c45fb]::query::erase::Erased<[u8; 8usize]>>
  28:     0x7f823ad30ff5 - rustc_query_system[fda0dd1a18d51465]::query::plumbing::try_execute_query::<rustc_query_impl[13bcb7b07dc4d660]::SemiDynamicQueryDispatcher<rustc_data_structures[c9669210c0b9186b]::vec_cache::VecCache<rustc_hir_id[b437bd80822f8ed3]::OwnerId, rustc_middle[ae72f8db201c45fb]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[fda0dd1a18d51465]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[13bcb7b07dc4d660]::plumbing::QueryCtxt, false>
  29:     0x7f823ad308c9 - rustc_query_impl[13bcb7b07dc4d660]::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace
  30:     0x7f823ad29b2a - rustc_mir_build[caaca64e226810d2]::check_unsafety::check_unsafety
  31:     0x7f823ad29899 - rustc_query_impl[13bcb7b07dc4d660]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[13bcb7b07dc4d660]::query_impl::check_unsafety::make_query_vtable::{closure#2}::{closure#0}, rustc_middle[ae72f8db201c45fb]::query::erase::Erased<[u8; 0usize]>>
  32:     0x7f823ad27302 - rustc_query_system[fda0dd1a18d51465]::query::plumbing::try_execute_query::<rustc_query_impl[13bcb7b07dc4d660]::SemiDynamicQueryDispatcher<rustc_data_structures[c9669210c0b9186b]::vec_cache::VecCache<rustc_span[101d8a10560d0148]::def_id::LocalDefId, rustc_middle[ae72f8db201c45fb]::query::erase::Erased<[u8; 0usize]>, rustc_query_system[fda0dd1a18d51465]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[13bcb7b07dc4d660]::plumbing::QueryCtxt, false>
  33:     0x7f823ad2707d - rustc_query_impl[13bcb7b07dc4d660]::query_impl::check_unsafety::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7f823ad260e6 - <rustc_middle[ae72f8db201c45fb]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[909c88ca5ae84a20]::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}
  35:     0x7f823ad23c0a - rustc_interface[909c88ca5ae84a20]::passes::analysis
  36:     0x7f823ad2302b - rustc_query_impl[13bcb7b07dc4d660]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[13bcb7b07dc4d660]::query_impl::analysis::make_query_vtable::{closure#2}::{closure#0}, rustc_middle[ae72f8db201c45fb]::query::erase::Erased<[u8; 0usize]>>
  37:     0x7f823bdea1e6 - rustc_query_system[fda0dd1a18d51465]::query::plumbing::try_execute_query::<rustc_query_impl[13bcb7b07dc4d660]::SemiDynamicQueryDispatcher<rustc_query_system[fda0dd1a18d51465]::query::caches::SingleCache<rustc_middle[ae72f8db201c45fb]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[13bcb7b07dc4d660]::plumbing::QueryCtxt, false>
  38:     0x7f823bde9ec2 - rustc_query_impl[13bcb7b07dc4d660]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  39:     0x7f823bf28a6c - <rustc_interface[909c88ca5ae84a20]::passes::create_and_enter_global_ctxt<core[5cc72673e270ff3e]::option::Option<rustc_interface[909c88ca5ae84a20]::queries::Linker>, rustc_driver_impl[f932d213bb3ade3d]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[5cc72673e270ff3e]::ops::function::FnOnce<(&rustc_session[76fc6592b209b26]::session::Session, rustc_middle[ae72f8db201c45fb]::ty::context::CurrentGcx, alloc[207d8e8634fd4110]::sync::Arc<rustc_data_structures[c9669210c0b9186b]::jobserver::Proxy>, &std[d7a9ad9d2397029e]::sync::once_lock::OnceLock<rustc_middle[ae72f8db201c45fb]::ty::context::GlobalCtxt>, &rustc_data_structures[c9669210c0b9186b]::sync::worker_local::WorkerLocal<rustc_middle[ae72f8db201c45fb]::arena::Arena>, &rustc_data_structures[c9669210c0b9186b]::sync::worker_local::WorkerLocal<rustc_hir[6fb796084409818f]::Arena>, rustc_driver_impl[f932d213bb3ade3d]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  40:     0x7f823bdaf488 - rustc_interface[909c88ca5ae84a20]::interface::run_compiler::<(), rustc_driver_impl[f932d213bb3ade3d]::run_compiler::{closure#0}>::{closure#1}
  41:     0x7f823bdd0d3e - std[d7a9ad9d2397029e]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[909c88ca5ae84a20]::util::run_in_thread_with_globals<rustc_interface[909c88ca5ae84a20]::util::run_in_thread_pool_with_globals<rustc_interface[909c88ca5ae84a20]::interface::run_compiler<(), rustc_driver_impl[f932d213bb3ade3d]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  42:     0x7f823bdd1260 - <std[d7a9ad9d2397029e]::thread::lifecycle::spawn_unchecked<rustc_interface[909c88ca5ae84a20]::util::run_in_thread_with_globals<rustc_interface[909c88ca5ae84a20]::util::run_in_thread_pool_with_globals<rustc_interface[909c88ca5ae84a20]::interface::run_compiler<(), rustc_driver_impl[f932d213bb3ade3d]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[5cc72673e270ff3e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  43:     0x7f823bdd20ec - <std[d7a9ad9d2397029e]::sys::thread::unix::Thread>::new::thread_start
  44:     0x7f823569698b - <unknown>
  45:     0x7f823571a9cc - <unknown>
  46:                0x0 - <unknown>

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.95.0-nightly (1e5065a4d 2026-01-28) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_match] match-checking `tuple_tuple_ref_pin_mut_pat_and_pin_mut_of_tuple_mut_of_tuple_pin_mut_ty`
#1 [mir_built] building MIR for `tuple_tuple_ref_pin_mut_pat_and_pin_mut_of_tuple_mut_of_tuple_pin_mut_ty`
#2 [check_unsafety] unsafety-checking `tuple_tuple_ref_pin_mut_pat_and_pin_mut_of_tuple_mut_of_tuple_pin_mut_ty`
#3 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 2 previous errors; 2 warnings emitted

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

@rustbot label +F-ref_pat_eat_one_layer_2024 +F-pin_ergonomics

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied snippet with the referenced nightly toolchain, then read compiler/rustc_pattern_analysis/src/rustc.rs around lines 474-486 and the ICE backtrace through RustcPatCtxt::lower_pat. The design must establish how pin ergonomics interacts with match ergonomics and RFC 3627 before determining the expected behavior and how the panic is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.