about summary refs log tree commit diff
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-01-28 03:29:00 +0800
committerkennytm <kennytm@gmail.com>2018-03-15 16:58:02 +0800
commita4d80336c96d7f47b0ef025fa141a9c96abcafbd (patch)
tree92ba828c6846d7eedd83656cb03f441dfcf58897
parent92d1f8d8e4be62e6f4dc32bc57f9d44f53117ec9 (diff)
downloadrust-a4d80336c96d7f47b0ef025fa141a9c96abcafbd.tar.gz
rust-a4d80336c96d7f47b0ef025fa141a9c96abcafbd.zip
Stabilize `dotdoteq_in_patterns` language feature.
Stabilize `match 2 { 1..=3 => {} }`.
-rw-r--r--src/libsyntax/feature_gate.rs11
-rw-r--r--src/test/run-pass/inc-range-pat.rs2
-rw-r--r--src/test/ui/feature-gate-dotdoteq_in_patterns.rs16
-rw-r--r--src/test/ui/feature-gate-dotdoteq_in_patterns.stderr11
4 files changed, 3 insertions, 37 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index a415117b599..51fa1489599 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -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");
diff --git a/src/test/run-pass/inc-range-pat.rs b/src/test/run-pass/inc-range-pat.rs
index 5faf36eddaf..237b41b6128 100644
--- a/src/test/run-pass/inc-range-pat.rs
+++ b/src/test/run-pass/inc-range-pat.rs
@@ -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 });
diff --git a/src/test/ui/feature-gate-dotdoteq_in_patterns.rs b/src/test/ui/feature-gate-dotdoteq_in_patterns.rs
deleted file mode 100644
index 1fb139bf07f..00000000000
--- a/src/test/ui/feature-gate-dotdoteq_in_patterns.rs
+++ /dev/null
@@ -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
-        _ => {}
-    }
-}
diff --git a/src/test/ui/feature-gate-dotdoteq_in_patterns.stderr b/src/test/ui/feature-gate-dotdoteq_in_patterns.stderr
deleted file mode 100644
index 67f15be9d08..00000000000
--- a/src/test/ui/feature-gate-dotdoteq_in_patterns.stderr
+++ /dev/null
@@ -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`.