From a3818685e412435d6faecfcf9b016b4eb7627e90 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Sat, 22 Sep 2018 17:07:56 -0700 Subject: [PATCH] stabilize pattern_parentheses feature --- src/libsyntax/feature_gate.rs | 9 ++------- src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs | 4 +--- .../feature-gate-pattern_parentheses.rs | 15 --------------- .../feature-gate-pattern_parentheses.stderr | 11 ----------- src/test/ui/run-pass/binding/pat-tuple-7.rs | 1 - .../binding/range-inclusive-pattern-precedence.rs | 2 +- 6 files changed, 4 insertions(+), 38 deletions(-) delete mode 100644 src/test/ui/feature-gates/feature-gate-pattern_parentheses.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-pattern_parentheses.stderr diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index d44d2146d82..1befc8e3ee0 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -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) diff --git a/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs b/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs index 6ae06f2d561..8f54f2e2dc3 100644 --- a/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs +++ b/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs @@ -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 => () diff --git a/src/test/ui/feature-gates/feature-gate-pattern_parentheses.rs b/src/test/ui/feature-gates/feature-gate-pattern_parentheses.rs deleted file mode 100644 index 29768018f0e..00000000000 --- a/src/test/ui/feature-gates/feature-gate-pattern_parentheses.rs +++ /dev/null @@ -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 or the MIT license -// , 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 - } -} diff --git a/src/test/ui/feature-gates/feature-gate-pattern_parentheses.stderr b/src/test/ui/feature-gates/feature-gate-pattern_parentheses.stderr deleted file mode 100644 index 4268d27ebec..00000000000 --- a/src/test/ui/feature-gates/feature-gate-pattern_parentheses.stderr +++ /dev/null @@ -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`. diff --git a/src/test/ui/run-pass/binding/pat-tuple-7.rs b/src/test/ui/run-pass/binding/pat-tuple-7.rs index c6730f14bc4..c32b52eac33 100644 --- a/src/test/ui/run-pass/binding/pat-tuple-7.rs +++ b/src/test/ui/run-pass/binding/pat-tuple-7.rs @@ -9,7 +9,6 @@ // except according to those terms. // run-pass -#![feature(pattern_parentheses)] fn main() { match 0 { diff --git a/src/test/ui/run-pass/binding/range-inclusive-pattern-precedence.rs b/src/test/ui/run-pass/binding/range-inclusive-pattern-precedence.rs index 350a64781cd..d492edb1617 100644 --- a/src/test/ui/run-pass/binding/range-inclusive-pattern-precedence.rs +++ b/src/test/ui/run-pass/binding/range-inclusive-pattern-precedence.rs @@ -9,7 +9,7 @@ // except according to those terms. // run-pass -#![feature(box_patterns, pattern_parentheses)] +#![feature(box_patterns)] const VALUE: usize = 21;