Change:
<!-- [31mICE[0m: Rustc '' 'error: internal compiler error: pattern has unexpected type: pat: Pat { ty: FnDef(DefId(0:4 ~ 8AA6F1005370219B85951C99272A39FD19B661E1BACC8A2564FDDA6681DF61B2[9399]::S::{constructor}), []), span: 32:14 (), kind: Leaf { subpatterns: [] } }, ty: FnDef(DefId(0:4 ~ 8AA6F1005370219B85951C99272A39FD19B661E1BACC8A2564FDDA6681DF61B2[9399]::S::{constructor}), [])', 'error: internal compiler error: pattern has unexpected type: pat: Pat { ty: FnDef(DefId(0:4 ~ 8AA6F1005370219B85951C99272A39FD19B661E1BACC8A2564FDDA6681DF61B2[9399]::S::{constructor}), []), span: 32:14 (), kind: Leaf { subpatterns: [] } }, ty: FnDef(DefId(0:4 ~ 8AA6F1005370219B85951C99272A39FD19B661E1BACC8A2564FDDA6681DF61B2[9399]::S::{constructor}), [])' File: --auto-reduced (treereduce-rust): original: Version information ` Command: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongProgram output</strong</summary<p</p</details<!-- query stack: error: internal compiler error: pattern has unexpected type: pat: Pat { ty: FnDef(DefId(0:4 ~ mvce[320f]::S::{constructor}), []), span: 14:14 (), kind: Leaf { subpatterns: [] } }, ty: FnDef(DefId(0:4 ~ mvce[320f]::S::{constructor}), []) [checkmatch] match-checking [mirbuilt] building MIR for [checkunsafety] unsafety-checking [analysis] running analysis passes on this crate --
cc
This has ICEd before :
^Regression in nightly-2022-05-05 commit[0] 2022-05-03: Auto merge of - bjorn3:librarifyparseformat, r=davidtwco commit[1] 2022-05-03: Auto merge of - compiler-errors:unit-destructure-assign, r=nikomatsakis commit[2] 2022-05-04: Auto merge of - estebank:issue-, r=compiler-errors commit[3] 2022-05-04: Auto merge of - petrochenkov:docregr, r=GuillaumeGomez commit[4] 2022-05-04: Auto merge of - ehuss:update-cargo, r=ehuss commit[5] 2022-05-04: Auto merge of - JohnTitor:rollup-oo4fc1h, r=JohnTitor commit[6] 2022-05-04: Auto merge of - oli-obk:operandorder, r=davidtwco commit[7] 2022-05-04: Auto merge of - nnethercote:speed-up-Token-ident-lifetime, r=petrochenkov commit[8] 2022-05-04: Auto merge of - nnethercote:overhaul-MacArgs, r=petrochenkov would not be surprised if its actually :seeno_evil:
So only this specific case seems to be . Matching tuple ctors in patterns and ICEing is older than that:
Regression in nightly-2020-11-19 fetching (via remote github) commits from max(, 2020-11-16) to ending github query because we found starting sha: getcommitsbetween returning commits, len: 6 commit[0] 2020-11-17: Auto merge of - m-ou-se:rollup-owel5ld, r=m-ou-se commit[1] 2020-11-18: Auto merge of - pietroalbini:beta-next, r=Mark-Simulacrum commit[2] 2020-11-18: Auto merge of - jyn514:from-inner, r=petrochenkov commit[3] 2020-11-18: Auto merge of - pietroalbini:woops, r=pietroalbini commit[4] 2020-11-18: Auto merge of - m-ou-se:rollup-4g15apk, r=m-ou-se commit[5] 2020-11-18: Auto merge of - Nadrieril:clean-empty-match, r=varkor

Discussion:
let e = report_unexpected_variant_res(tcx, res, qpath, pat.span, E0533, expected); return Ty::new_error(tcx, e); } <del> Res::SelfCtor(..) | Res::Def( </del> <ins> Res::SelfCtor(def_id) => { if let ty::Adt(adt_def, _) = *tcx.type_of(def_id).skip_binder().kind() && adt_def.is_struct() && let Some((CtorKind::Const, _)) = adt_def.non_enum_variant().ctor { // Ok, we allow unit struct ctors in patterns only. } else { let e = report_unexpected_variant_res( tcx, res, qpath, pat.span, E0533, "unit struct", ); return Ty::new_error(tcx, e); } } Res::Def( </ins> DefKind::Ctor(_, CtorKind::Const) | DefKind::Const | DefKind::AssocConst

fn foo(&mur Self) {} //~^ ERROR expected identifier, found keyword `Self` //~| ERROR expected one of `:`, `@` <del> //~| ERROR the `Self` constructor can only be used with </del> <ins> //~| ERROR expected unit struct, found self constructor `Self` </ins> fn bar(&'static mur Self) {} //~^ ERROR unexpected lifetime //~| ERROR expected identifier, found keyword `Self` //~| ERROR expected one of `:`, `@` <del> //~| ERROR the `Self` constructor can only be used with </del> <ins> //~| ERROR expected unit struct, found self constructor `Self` </ins> fn baz(&mur Self @ _) {} //~^ ERROR expected one of `:`, `@`

LL |     fn baz(&mur Self @ _) {} |                 ^^^^ expected one of `:`, `@`, or `|` <del> error: the `Self` constructor can only be used with tuple or unit structs </del> <ins> error[E0533]: expected unit struct, found self constructor `Self` </ins> --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:4:17 | LL |     fn foo(&mur Self) {} <del> |                 ^^^^ help: use curly brackets: `Self { /* fields */ }` </del> <ins> |                 ^^^^ not a unit struct </ins> <del> error: the `Self` constructor can only be used with tuple or unit structs </del> <ins> error[E0533]: expected unit struct, found self constructor `Self` </ins> --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:8:25 | LL |     fn bar(&'static mur Self) {} <del> |                         ^^^^ help: use curly brackets: `Self { /* fields */ }` </del> <ins> |                         ^^^^ not a unit struct </ins> error: aborting due to 8 previous errors <ins> For more information about this error, try `rustc --explain E0533`. </ins>

<ins> //@ revisions: tuple unit struct_ //@[unit] check-pass #[cfg(unit)] mod unit { struct S; impl S { fn foo() { let Self = S; } } } #[cfg(tuple)] mod tuple { struct S(()); impl S { fn foo() { let Self = S; //[tuple]~^ ERROR expected unit struct } } } #[cfg(struct_)] mod struct_ { struct S {} impl S { fn foo() { let Self = S; //[struct_]~^ ERROR expected value, found struct `S` //[struct_]~| ERROR expected unit struct, found self constructor `Self` } } } fn main() {} </ins>

<ins> error[E0423]: expected value, found struct `S` --> $DIR/no-match-tuple-variant-self-ctor.rs:30:24 | LL |     struct S {} |     ----------- `S` defined here ... LL |             let Self = S; |                        ^ help: use struct literal syntax instead: `S {}` error[E0533]: expected unit struct, found self constructor `Self` --> $DIR/no-match-tuple-variant-self-ctor.rs:30:17 | LL |             let Self = S; |                 ^^^^ not a unit struct error: aborting due to 2 previous errors Some errors have detailed explanations: E0423, E0533. For more information about an error, try `rustc --explain E0423`. </ins>

<ins> error[E0533]: expected unit struct, found self constructor `Self` --> $DIR/no-match-tuple-variant-self-ctor.rs:19:17 | LL |             let Self = S; |                 ^^^^ not a unit struct error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0533`. </ins>