Skip to content

Commit

Permalink
stabilize :pat2015, leave :pat2021 gated
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-i-m committed Apr 15, 2021
1 parent 2962e7c commit ebc4ace
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 27 deletions.
23 changes: 10 additions & 13 deletions compiler/rustc_expand/src/mbe/quoted.rs
Expand Up @@ -62,19 +62,16 @@ 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();
}
}
_ => {}
if matches!(frag.name, sym::pat2021)
&& !features.edition_macro_pats
{
feature_err(
sess,
sym::edition_macro_pats,
frag.span,
"`pat2021` is unstable.",
)
.emit();
}

let kind =
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_feature/src/active.rs
Expand Up @@ -609,7 +609,7 @@ declare_features! (
/// Allows arbitrary expressions in key-value attributes at parse time.
(active, extended_key_value_attributes, "1.50.0", Some(78835), None),

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

/// Allows const generics to have default values (e.g. `struct Foo<const N: usize = 3>(...);`).
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/feature-gates/feature-gate-edition_macro_pats.rs
@@ -1,8 +1,8 @@
// Feature gate test for `edition_macro_pats` feature.

macro_rules! foo {
($x:pat2015) => {}; //~ERROR `pat2015` and `pat2021` are unstable
($x:pat2021) => {}; //~ERROR `pat2015` and `pat2021` are unstable
($x:pat2015) => {}; // ok
($x:pat2021) => {}; //~ERROR `pat2021` is unstable
}

fn main() {}
13 changes: 2 additions & 11 deletions src/test/ui/feature-gates/feature-gate-edition_macro_pats.stderr
@@ -1,13 +1,4 @@
error[E0658]: `pat2015` and `pat2021` are unstable.
--> $DIR/feature-gate-edition_macro_pats.rs:4:9
|
LL | ($x:pat2015) => {};
| ^^^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(edition_macro_pats)]` to the crate attributes to enable

error[E0658]: `pat2015` and `pat2021` are unstable.
error[E0658]: `pat2021` is unstable.
--> $DIR/feature-gate-edition_macro_pats.rs:5:9
|
LL | ($x:pat2021) => {};
Expand All @@ -16,6 +7,6 @@ LL | ($x:pat2021) => {};
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(edition_macro_pats)]` to the crate attributes to enable

error: aborting due to 2 previous errors
error: aborting due to previous error

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

0 comments on commit ebc4ace

Please sign in to comment.