Stabilize dotdoteq_in_patterns language feature.

Stabilize `match 2 { 1..=3 => {} }`.
This commit is contained in:
kennytm 2018-01-28 03:29:00 +08:00
parent 92d1f8d8e4
commit a4d80336c9
No known key found for this signature in database
GPG key ID: FEF6C8051D0E013C
4 changed files with 3 additions and 37 deletions

View file

@ -26,7 +26,7 @@ use self::AttributeType::*;
use self::AttributeGate::*;
use abi::Abi;
use ast::{self, NodeId, PatKind, RangeEnd, RangeSyntax};
use ast::{self, NodeId, PatKind, RangeEnd};
use attr;
use epoch::Epoch;
use codemap::Spanned;
@ -399,9 +399,6 @@ declare_features! (
// allow `'_` placeholder lifetimes
(active, underscore_lifetimes, "1.22.0", Some(44524), None),
// allow `..=` in patterns (RFC 1192)
(active, dotdoteq_in_patterns, "1.22.0", Some(28237), None),
// Default match binding modes (RFC 2005)
(active, match_default_bindings, "1.22.0", Some(42640), None),
@ -553,6 +550,8 @@ declare_features! (
(accepted, use_nested_groups, "1.25.0", Some(44494), None),
// a..=b and ..=b
(accepted, inclusive_range_syntax, "1.26.0", Some(28237), None),
// allow `..=` in patterns (RFC 1192)
(accepted, dotdoteq_in_patterns, "1.26.0", Some(28237), None),
);
// If you change this, please modify src/doc/unstable-book as well. You must
@ -1652,10 +1651,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
gate_feature_post!(&self, exclusive_range_pattern, pattern.span,
"exclusive range pattern syntax is experimental");
}
PatKind::Range(_, _, RangeEnd::Included(RangeSyntax::DotDotEq)) => {
gate_feature_post!(&self, dotdoteq_in_patterns, pattern.span,
"`..=` syntax in patterns is experimental");
}
PatKind::Paren(..) => {
gate_feature_post!(&self, pattern_parentheses, pattern.span,
"parentheses in patterns are unstable");

View file

@ -9,8 +9,6 @@
// except according to those terms.
// Test old and new syntax for inclusive range patterns.
#![feature(dotdoteq_in_patterns)]
fn main() {
assert!(match 42 { 0 ... 100 => true, _ => false });

View file

@ -1,16 +0,0 @@
// Copyright 2014 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.
pub fn main() {
match 22 {
0 ..= 3 => {} //~ ERROR `..=` syntax in patterns is experimental
_ => {}
}
}

View file

@ -1,11 +0,0 @@
error[E0658]: `..=` syntax in patterns is experimental (see issue #28237)
--> $DIR/feature-gate-dotdoteq_in_patterns.rs:13:9
|
LL | 0 ..= 3 => {} //~ ERROR `..=` syntax in patterns is experimental
| ^^^^^^^
|
= help: add #![feature(dotdoteq_in_patterns)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.