Auto merge of #54497 - ralexstokes:stabilize_pattern_parentheses, r=nikomatsakis
Stabilize pattern_parentheses feature Addresses #51087 . Stabilizes the previously unstable feature `pattern_parentheses` which enables the use of `()` in match patterns.
This commit is contained in:
commit
a2b27c19da
7 changed files with 197 additions and 161 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue