stabilize pattern_parentheses feature

This commit is contained in:
Alex Stokes 2018-09-22 17:07:56 -07:00
parent de5f6ee3c6
commit a3818685e4
6 changed files with 4 additions and 38 deletions

View File

@ -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)

View File

@ -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 => ()

View File

@ -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
}
}

View File

@ -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`.

View File

@ -9,7 +9,6 @@
// except according to those terms.
// run-pass
#![feature(pattern_parentheses)]
fn main() {
match 0 {

View File

@ -9,7 +9,7 @@
// except according to those terms.
// run-pass
#![feature(box_patterns, pattern_parentheses)]
#![feature(box_patterns)]
const VALUE: usize = 21;