Skip to content

Commit ebc4ace

Browse files
committed
stabilize :pat2015, leave :pat2021 gated
1 parent 2962e7c commit ebc4ace

File tree

4 files changed

+15
-27
lines changed

4 files changed

+15
-27
lines changed

compiler/rustc_expand/src/mbe/quoted.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,16 @@ pub(super) fn parse(
6262
Some((frag, _)) => {
6363
let span = token.span.with_lo(start_sp.lo());
6464

65-
match frag.name {
66-
sym::pat2015 | sym::pat2021 => {
67-
if !features.edition_macro_pats {
68-
feature_err(
69-
sess,
70-
sym::edition_macro_pats,
71-
frag.span,
72-
"`pat2015` and `pat2021` are unstable.",
73-
)
74-
.emit();
75-
}
76-
}
77-
_ => {}
65+
if matches!(frag.name, sym::pat2021)
66+
&& !features.edition_macro_pats
67+
{
68+
feature_err(
69+
sess,
70+
sym::edition_macro_pats,
71+
frag.span,
72+
"`pat2021` is unstable.",
73+
)
74+
.emit();
7875
}
7976

8077
let kind =

compiler/rustc_feature/src/active.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ declare_features! (
609609
/// Allows arbitrary expressions in key-value attributes at parse time.
610610
(active, extended_key_value_attributes, "1.50.0", Some(78835), None),
611611

612-
/// `:pat2015` and `:pat2021` macro matchers.
612+
/// `:pat2021` macro matcher.
613613
(active, edition_macro_pats, "1.51.0", Some(54883), None),
614614

615615
/// Allows const generics to have default values (e.g. `struct Foo<const N: usize = 3>(...);`).
Lines changed: 2 additions & 2 deletions
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:pat2015) => {}; //~ERROR `pat2015` and `pat2021` are unstable
5-
($x:pat2021) => {}; //~ERROR `pat2015` and `pat2021` are unstable
4+
($x:pat2015) => {}; // ok
5+
($x:pat2021) => {}; //~ERROR `pat2021` is unstable
66
}
77

88
fn main() {}
Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
error[E0658]: `pat2015` and `pat2021` are unstable.
2-
--> $DIR/feature-gate-edition_macro_pats.rs:4:9
3-
|
4-
LL | ($x:pat2015) => {};
5-
| ^^^^^^^
6-
|
7-
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
8-
= help: add `#![feature(edition_macro_pats)]` to the crate attributes to enable
9-
10-
error[E0658]: `pat2015` and `pat2021` are unstable.
1+
error[E0658]: `pat2021` is unstable.
112
--> $DIR/feature-gate-edition_macro_pats.rs:5:9
123
|
134
LL | ($x:pat2021) => {};
@@ -16,6 +7,6 @@ LL | ($x:pat2021) => {};
167
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
178
= help: add `#![feature(edition_macro_pats)]` to the crate attributes to enable
189

19-
error: aborting due to 2 previous errors
10+
error: aborting due to previous error
2011

2112
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)