mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 18:53:39 +00:00
stabilize pattern_parentheses feature
This commit is contained in:
parent
de5f6ee3c6
commit
a3818685e4
@ -412,9 +412,6 @@ declare_features! (
|
||||
// Multiple patterns with `|` in `if let` and `while let`
|
||||
(active, if_while_or_patterns, "1.26.0", Some(48215), None),
|
||||
|
||||
// Parentheses in patterns
|
||||
(active, pattern_parentheses, "1.26.0", Some(51087), None),
|
||||
|
||||
// Allows `#[repr(packed)]` attribute on structs
|
||||
(active, repr_packed, "1.26.0", Some(33158), None),
|
||||
|
||||
@ -680,6 +677,8 @@ declare_features! (
|
||||
(accepted, extern_absolute_paths, "1.30.0", Some(44660), None),
|
||||
// Access to crate names passed via `--extern` through prelude
|
||||
(accepted, extern_prelude, "1.30.0", Some(44660), None),
|
||||
// Parentheses in patterns
|
||||
(accepted, pattern_parentheses, "1.31.0", Some(51087), None),
|
||||
);
|
||||
|
||||
// If you change this, please modify src/doc/unstable-book as well. You must
|
||||
@ -1773,10 +1772,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||
gate_feature_post!(&self, exclusive_range_pattern, pattern.span,
|
||||
"exclusive range pattern syntax is experimental");
|
||||
}
|
||||
PatKind::Paren(..) => {
|
||||
gate_feature_post!(&self, pattern_parentheses, pattern.span,
|
||||
"parentheses in patterns are unstable");
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
visit::walk_pat(self, pattern)
|
||||
|
@ -284,9 +284,7 @@ fn run() {
|
||||
reject_stmt_parse("#[attr] #![attr] foo!{}");
|
||||
|
||||
// FIXME: Allow attributes in pattern constexprs?
|
||||
// would require parens in patterns to allow disambiguation...
|
||||
// —which is now available under the `pattern_parentheses` feature gate
|
||||
// (tracking issue #51087)
|
||||
// note: requires parens in patterns to allow disambiguation
|
||||
|
||||
reject_expr_parse("match 0 {
|
||||
0..=#[attr] 10 => ()
|
||||
|
@ -1,15 +0,0 @@
|
||||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
match 0 {
|
||||
(pat) => {} //~ ERROR parentheses in patterns are unstable
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
error[E0658]: parentheses in patterns are unstable (see issue #51087)
|
||||
--> $DIR/feature-gate-pattern_parentheses.rs:13:9
|
||||
|
|
||||
LL | (pat) => {} //~ ERROR parentheses in patterns are unstable
|
||||
| ^^^^^
|
||||
|
|
||||
= help: add #![feature(pattern_parentheses)] to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// run-pass
|
||||
#![feature(pattern_parentheses)]
|
||||
|
||||
fn main() {
|
||||
match 0 {
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
// run-pass
|
||||
#![feature(box_patterns, pattern_parentheses)]
|
||||
#![feature(box_patterns)]
|
||||
|
||||
const VALUE: usize = 21;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user