Skip to content

Commit 8c4b3db

Browse files
committed
rename :pat2018 -> :pat215
1 parent d04c3aa commit 8c4b3db

File tree

9 files changed

+21
-21
lines changed

9 files changed

+21
-21
lines changed

compiler/rustc_ast/src/token.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -688,13 +688,13 @@ pub enum NonterminalKind {
688688
Item,
689689
Block,
690690
Stmt,
691-
Pat2018 {
692-
/// Keep track of whether the user used `:pat2018` or `:pat` and we inferred it from the
691+
Pat2015 {
692+
/// Keep track of whether the user used `:pat2015` or `:pat` and we inferred it from the
693693
/// edition of the span. This is used for diagnostics.
694694
inferred: bool,
695695
},
696696
Pat2021 {
697-
/// Keep track of whether the user used `:pat2018` or `:pat` and we inferred it from the
697+
/// Keep track of whether the user used `:pat2015` or `:pat` and we inferred it from the
698698
/// edition of the span. This is used for diagnostics.
699699
inferred: bool,
700700
},
@@ -722,11 +722,11 @@ impl NonterminalKind {
722722
sym::stmt => NonterminalKind::Stmt,
723723
sym::pat => match edition() {
724724
Edition::Edition2015 | Edition::Edition2018 => {
725-
NonterminalKind::Pat2018 { inferred: true }
725+
NonterminalKind::Pat2015 { inferred: true }
726726
}
727727
Edition::Edition2021 => NonterminalKind::Pat2021 { inferred: true },
728728
},
729-
sym::pat2018 => NonterminalKind::Pat2018 { inferred: false },
729+
sym::pat2015 => NonterminalKind::Pat2015 { inferred: false },
730730
sym::pat2021 => NonterminalKind::Pat2021 { inferred: false },
731731
sym::expr => NonterminalKind::Expr,
732732
sym::ty => NonterminalKind::Ty,
@@ -745,9 +745,9 @@ impl NonterminalKind {
745745
NonterminalKind::Item => sym::item,
746746
NonterminalKind::Block => sym::block,
747747
NonterminalKind::Stmt => sym::stmt,
748-
NonterminalKind::Pat2018 { inferred: false } => sym::pat2018,
748+
NonterminalKind::Pat2015 { inferred: false } => sym::pat2015,
749749
NonterminalKind::Pat2021 { inferred: false } => sym::pat2021,
750-
NonterminalKind::Pat2018 { inferred: true }
750+
NonterminalKind::Pat2015 { inferred: true }
751751
| NonterminalKind::Pat2021 { inferred: true } => sym::pat,
752752
NonterminalKind::Expr => sym::expr,
753753
NonterminalKind::Ty => sym::ty,

compiler/rustc_expand/src/mbe/macro_rules.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow {
10801080
_ => IsInFollow::No(TOKENS),
10811081
}
10821082
}
1083-
NonterminalKind::Pat2018 { .. } | NonterminalKind::Pat2021 { .. } => {
1083+
NonterminalKind::Pat2015 { .. } | NonterminalKind::Pat2021 { .. } => {
10841084
const TOKENS: &[&str] = &["`=>`", "`,`", "`=`", "`|`", "`if`", "`in`"];
10851085
match tok {
10861086
TokenTree::Token(token) => match token.kind {

compiler/rustc_expand/src/mbe/quoted.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ pub(super) fn parse(
6363
let span = token.span.with_lo(start_sp.lo());
6464

6565
match frag.name {
66-
sym::pat2018 | sym::pat2021 => {
66+
sym::pat2015 | sym::pat2021 => {
6767
if !features.edition_macro_pats {
6868
feature_err(
6969
sess,
7070
sym::edition_macro_pats,
7171
frag.span,
72-
"`pat2018` and `pat2021` are unstable.",
72+
"`pat2015` and `pat2021` are unstable.",
7373
)
7474
.emit();
7575
}

compiler/rustc_feature/src/active.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ declare_features! (
614614
/// Allows arbitrary expressions in key-value attributes at parse time.
615615
(active, extended_key_value_attributes, "1.50.0", Some(78835), None),
616616

617-
/// `:pat2018` and `:pat2021` macro matchers.
617+
/// `:pat2015` and `:pat2021` macro matchers.
618618
(active, edition_macro_pats, "1.51.0", Some(54883), None),
619619

620620
/// Allows const generics to have default values (e.g. `struct Foo<const N: usize = 3>(...);`).

compiler/rustc_parse/src/parser/nonterminal.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl<'a> Parser<'a> {
6161
},
6262
_ => false,
6363
},
64-
NonterminalKind::Pat2018 { .. } | NonterminalKind::Pat2021 { .. } => match token.kind {
64+
NonterminalKind::Pat2015 { .. } | NonterminalKind::Pat2021 { .. } => match token.kind {
6565
token::Ident(..) | // box, ref, mut, and other identifiers (can stricten)
6666
token::OpenDelim(token::Paren) | // tuple pattern
6767
token::OpenDelim(token::Bracket) | // slice pattern
@@ -118,9 +118,9 @@ impl<'a> Parser<'a> {
118118
return Err(self.struct_span_err(self.token.span, "expected a statement"));
119119
}
120120
},
121-
NonterminalKind::Pat2018 { .. } | NonterminalKind::Pat2021 { .. } => {
121+
NonterminalKind::Pat2015 { .. } | NonterminalKind::Pat2021 { .. } => {
122122
token::NtPat(self.collect_tokens_no_attrs(|this| match kind {
123-
NonterminalKind::Pat2018 { .. } => this.parse_pat_no_top_alt(None),
123+
NonterminalKind::Pat2015 { .. } => this.parse_pat_no_top_alt(None),
124124
NonterminalKind::Pat2021 { .. } => {
125125
this.parse_pat_allow_top_alt(None, GateOr::Yes, RecoverComma::No)
126126
}

compiler/rustc_span/src/symbol.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ symbols! {
845845
partial_ord,
846846
passes,
847847
pat,
848-
pat2018,
848+
pat2015,
849849
pat2021,
850850
path,
851851
pattern_parentheses,
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Feature gate test for `edition_macro_pats` feature.
22

33
macro_rules! foo {
4-
($x:pat2018) => {}; //~ERROR `pat2018` and `pat2021` are unstable
5-
($x:pat2021) => {}; //~ERROR `pat2018` and `pat2021` are unstable
4+
($x:pat2015) => {}; //~ERROR `pat2015` and `pat2021` are unstable
5+
($x:pat2021) => {}; //~ERROR `pat2015` and `pat2021` are unstable
66
}
77

88
fn main() {}

src/test/ui/feature-gates/feature-gate-edition_macro_pats.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
error[E0658]: `pat2018` and `pat2021` are unstable.
1+
error[E0658]: `pat2015` and `pat2021` are unstable.
22
--> $DIR/feature-gate-edition_macro_pats.rs:4:9
33
|
4-
LL | ($x:pat2018) => {};
4+
LL | ($x:pat2015) => {};
55
| ^^^^^^^
66
|
77
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
88
= help: add `#![feature(edition_macro_pats)]` to the crate attributes to enable
99

10-
error[E0658]: `pat2018` and `pat2021` are unstable.
10+
error[E0658]: `pat2015` and `pat2021` are unstable.
1111
--> $DIR/feature-gate-edition_macro_pats.rs:5:9
1212
|
1313
LL | ($x:pat2021) => {};

src/test/ui/macros/edition-macro-pats.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![feature(edition_macro_pats)]
55

66
macro_rules! foo {
7-
(a $x:pat2018) => {};
7+
(a $x:pat2015) => {};
88
(b $x:pat2021) => {};
99
}
1010

0 commit comments

Comments
 (0)