diff options
| author | bors <bors@rust-lang.org> | 2021-04-28 20:35:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-04-28 20:35:17 +0000 |
| commit | ca075d268d2ce315964e1dd195cfe837b8a53f4d (patch) | |
| tree | 4129a237b61f9a4e21394269c0381274e5d1e216 /compiler/rustc_expand/src | |
| parent | da43ee8d821999bf92d9ce8c81f8979ecea2c80d (diff) | |
| parent | 2a9db919ffb30ca09a015877b6ab2ffab5633249 (diff) | |
| download | rust-ca075d268d2ce315964e1dd195cfe837b8a53f4d.tar.gz rust-ca075d268d2ce315964e1dd195cfe837b8a53f4d.zip | |
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 https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/or.20patterns/near/231133873, another FCP is not needed. r? `@nikomatsakis`
Diffstat (limited to 'compiler/rustc_expand/src')
| -rw-r--r-- | compiler/rustc_expand/src/mbe/macro_rules.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_expand/src/mbe/quoted.rs | 19 |
2 files changed, 7 insertions, 22 deletions
diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs index bc45c57596e..91d4a0f0d65 100644 --- a/compiler/rustc_expand/src/mbe/macro_rules.rs +++ b/compiler/rustc_expand/src/mbe/macro_rules.rs @@ -955,15 +955,15 @@ fn check_matcher_core( if let TokenTree::MetaVarDecl(span, name, Some(kind)) = *token { for next_token in &suffix_first.tokens { // Check if the old pat is used and the next token is `|`. - if let NonterminalKind::Pat2015 { inferred: true } = kind { + if let NonterminalKind::PatParam { inferred: true } = kind { if let TokenTree::Token(token) = next_token { if let BinOp(token) = token.kind { if let token::BinOpToken::Or = token { - // It is suggestion to use pat2015, for example: $x:pat -> $x:pat2015. + // It is suggestion to use pat_param, for example: $x:pat -> $x:pat_param. let suggestion = quoted_tt_to_string(&TokenTree::MetaVarDecl( span, name, - Some(NonterminalKind::Pat2015 { inferred: false }), + Some(NonterminalKind::PatParam { inferred: false }), )); sess.buffer_lint_with_diagnostic( &OR_PATTERNS_BACK_COMPAT, @@ -1105,7 +1105,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow { _ => IsInFollow::No(TOKENS), } } - NonterminalKind::Pat2015 { .. } => { + NonterminalKind::PatParam { .. } => { const TOKENS: &[&str] = &["`=>`", "`,`", "`=`", "`|`", "`if`", "`in`"]; match tok { TokenTree::Token(token) => match token.kind { @@ -1116,7 +1116,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow { _ => IsInFollow::No(TOKENS), } } - NonterminalKind::Pat2021 { .. } => { + NonterminalKind::PatWithOr { .. } => { const TOKENS: &[&str] = &["`=>`", "`,`", "`=`", "`if`", "`in`"]; match tok { TokenTree::Token(token) => match token.kind { diff --git a/compiler/rustc_expand/src/mbe/quoted.rs b/compiler/rustc_expand/src/mbe/quoted.rs index e205cb65d02..aca02ef93f8 100644 --- a/compiler/rustc_expand/src/mbe/quoted.rs +++ b/compiler/rustc_expand/src/mbe/quoted.rs @@ -6,8 +6,8 @@ use rustc_ast::tokenstream; use rustc_ast::{NodeId, DUMMY_NODE_ID}; use rustc_ast_pretty::pprust; use rustc_feature::Features; -use rustc_session::parse::{feature_err, ParseSess}; -use rustc_span::symbol::{kw, sym, Ident}; +use rustc_session::parse::ParseSess; +use rustc_span::symbol::{kw, Ident}; use rustc_span::Span; @@ -62,21 +62,6 @@ pub(super) fn parse( Some((frag, _)) => { let span = token.span.with_lo(start_sp.lo()); - match frag.name { - sym::pat2015 | sym::pat2021 => { - if !features.edition_macro_pats { - feature_err( - sess, - sym::edition_macro_pats, - frag.span, - "`pat2015` and `pat2021` are unstable.", - ) - .emit(); - } - } - _ => {} - } - let kind = token::NonterminalKind::from_symbol(frag.name, || { span.edition() |
