stabilize :pat2015, leave :pat2021 gated

This commit is contained in:
mark 2021-03-22 13:53:16 -05:00
parent 2962e7c008
commit ebc4acee91
4 changed files with 15 additions and 27 deletions

View File

@ -62,19 +62,16 @@ pub(super) fn parse(
Some((frag, _)) => { Some((frag, _)) => {
let span = token.span.with_lo(start_sp.lo()); let span = token.span.with_lo(start_sp.lo());
match frag.name { if matches!(frag.name, sym::pat2021)
sym::pat2015 | sym::pat2021 => { && !features.edition_macro_pats
if !features.edition_macro_pats { {
feature_err( feature_err(
sess, sess,
sym::edition_macro_pats, sym::edition_macro_pats,
frag.span, frag.span,
"`pat2015` and `pat2021` are unstable.", "`pat2021` is unstable.",
) )
.emit(); .emit();
}
}
_ => {}
} }
let kind = let kind =

View File

@ -609,7 +609,7 @@ pub fn set(&self, features: &mut Features, span: Span) {
/// Allows arbitrary expressions in key-value attributes at parse time. /// Allows arbitrary expressions in key-value attributes at parse time.
(active, extended_key_value_attributes, "1.50.0", Some(78835), None), (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), (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>(...);`). /// Allows const generics to have default values (e.g. `struct Foo<const N: usize = 3>(...);`).

View File

@ -1,8 +1,8 @@
// Feature gate test for `edition_macro_pats` feature. // Feature gate test for `edition_macro_pats` feature.
macro_rules! foo { macro_rules! foo {
($x:pat2015) => {}; //~ERROR `pat2015` and `pat2021` are unstable ($x:pat2015) => {}; // ok
($x:pat2021) => {}; //~ERROR `pat2015` and `pat2021` are unstable ($x:pat2021) => {}; //~ERROR `pat2021` is unstable
} }
fn main() {} fn main() {}

View File

@ -1,13 +1,4 @@
error[E0658]: `pat2015` and `pat2021` are unstable. error[E0658]: `pat2021` is 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.
--> $DIR/feature-gate-edition_macro_pats.rs:5:9 --> $DIR/feature-gate-edition_macro_pats.rs:5:9
| |
LL | ($x:pat2021) => {}; LL | ($x:pat2021) => {};
@ -16,6 +7,6 @@ LL | ($x:pat2021) => {};
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information = 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 = 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`. For more information about this error, try `rustc --explain E0658`.