Auto merge of #83386 - mark-i-m:stabilize-pat2015, r=nikomatsakis
Stabilize `:pat_param` and remove `:pat2021`
Blocked on #83384
cc `@rust-lang/lang` #79278
If I understand `@nikomatsakis` in 231133873
, another FCP is not needed.
r? `@nikomatsakis`
This commit is contained in:
commit
ca075d268d
15 changed files with 66 additions and 121 deletions
|
@ -61,7 +61,8 @@ impl<'a> Parser<'a> {
|
|||
},
|
||||
_ => false,
|
||||
},
|
||||
NonterminalKind::Pat2015 { .. } | NonterminalKind::Pat2021 { .. } => match token.kind {
|
||||
NonterminalKind::PatParam { .. } | NonterminalKind::PatWithOr { .. } => {
|
||||
match token.kind {
|
||||
token::Ident(..) | // box, ref, mut, and other identifiers (can stricten)
|
||||
token::OpenDelim(token::Paren) | // tuple pattern
|
||||
token::OpenDelim(token::Bracket) | // slice pattern
|
||||
|
@ -75,10 +76,11 @@ impl<'a> Parser<'a> {
|
|||
token::Lt | // path (UFCS constant)
|
||||
token::BinOp(token::Shl) => true, // path (double UFCS)
|
||||
// leading vert `|` or-pattern
|
||||
token::BinOp(token::Or) => matches!(kind, NonterminalKind::Pat2021 {..}),
|
||||
token::BinOp(token::Or) => matches!(kind, NonterminalKind::PatWithOr {..}),
|
||||
token::Interpolated(ref nt) => may_be_ident(nt),
|
||||
_ => false,
|
||||
},
|
||||
}
|
||||
}
|
||||
NonterminalKind::Lifetime => match token.kind {
|
||||
token::Lifetime(_) => true,
|
||||
token::Interpolated(ref nt) => {
|
||||
|
@ -118,10 +120,10 @@ impl<'a> Parser<'a> {
|
|||
return Err(self.struct_span_err(self.token.span, "expected a statement"));
|
||||
}
|
||||
},
|
||||
NonterminalKind::Pat2015 { .. } | NonterminalKind::Pat2021 { .. } => {
|
||||
NonterminalKind::PatParam { .. } | NonterminalKind::PatWithOr { .. } => {
|
||||
token::NtPat(self.collect_tokens_no_attrs(|this| match kind {
|
||||
NonterminalKind::Pat2015 { .. } => this.parse_pat_no_top_alt(None),
|
||||
NonterminalKind::Pat2021 { .. } => {
|
||||
NonterminalKind::PatParam { .. } => this.parse_pat_no_top_alt(None),
|
||||
NonterminalKind::PatWithOr { .. } => {
|
||||
this.parse_pat_allow_top_alt(None, RecoverComma::No)
|
||||
}
|
||||
_ => unreachable!(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue