From a4d80336c96d7f47b0ef025fa141a9c96abcafbd Mon Sep 17 00:00:00 2001 From: kennytm Date: Sun, 28 Jan 2018 03:29:00 +0800 Subject: [PATCH] Stabilize `dotdoteq_in_patterns` language feature. Stabilize `match 2 { 1..=3 => {} }`. --- src/libsyntax/feature_gate.rs | 11 +++-------- src/test/run-pass/inc-range-pat.rs | 2 -- src/test/ui/feature-gate-dotdoteq_in_patterns.rs | 16 ---------------- .../ui/feature-gate-dotdoteq_in_patterns.stderr | 11 ----------- 4 files changed, 3 insertions(+), 37 deletions(-) delete mode 100644 src/test/ui/feature-gate-dotdoteq_in_patterns.rs delete mode 100644 src/test/ui/feature-gate-dotdoteq_in_patterns.stderr diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index a415117b599be..51fa14895993d 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 5faf36eddaf06..237b41b6128cf 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 1fb139bf07f41..0000000000000 --- 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 or the MIT license -// , 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 67f15be9d0846..0000000000000 --- 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`.