Rollup merge of #139035 - nnethercote:PatKind-Missing, r=oli-obk

Add new `PatKind::Missing` variants

To avoid some ugly uses of `kw::Empty` when handling "missing" patterns, e.g. in bare fn tys. Helps with #137978. Details in the individual commits.

r? ``@oli-obk``
This commit is contained in:
Stuart Cook 2025-04-07 22:29:17 +10:00 committed by GitHub
commit 82df6229b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 92 additions and 66 deletions

View file

@ -2987,9 +2987,7 @@ impl<'a> Parser<'a> {
}
match ty {
Ok(ty) => {
let ident = Ident::new(kw::Empty, this.prev_token.span);
let bm = BindingMode::NONE;
let pat = this.mk_pat_ident(ty.span, bm, ident);
let pat = this.mk_pat(ty.span, PatKind::Missing);
(pat, ty)
}
// If this is a C-variadic argument and we hit an error, return the error.