use self::AttributeGate::*;
use abi::Abi;
-use ast::{self, NodeId, PatKind, RangeEnd};
+use ast::{self, NodeId, PatKind, RangeEnd, RangeSyntax};
use attr;
use codemap::Spanned;
use syntax_pos::Span;
// allow `'_` placeholder lifetimes
(active, underscore_lifetimes, "1.22.0", Some(44524)),
+
+ // allow `..=` in patterns (RFC 1192)
+ (active, dotdoteq_in_patterns, "1.22.0", Some(28237)),
);
declare_features! (
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");
+ }
_ => {}
}
visit::walk_pat(self, pattern)
--- /dev/null
+// 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
+ _ => {}
+ }
+}
// 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 });