summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorAlex Burka <aburka@seas.upenn.edu>2016-01-13 01:27:40 -0500
committerAlex Burka <aburka@seas.upenn.edu>2016-02-27 02:01:41 -0500
commit37a4cb32121bed9165f9bac696953f055f691aef (patch)
tree1a742e020c5a9570bf5a4e3a12233a1d0bbeec52 /src/libsyntax
parentbd3197c748e7bfa652fb636fbb78fa7a42d826ca (diff)
downloadrust-37a4cb32121bed9165f9bac696953f055f691aef.tar.gz
rust-37a4cb32121bed9165f9bac696953f055f691aef.zip
feature-gate inclusive range syntax
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/feature_gate.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 70bd85c00d4..9be52fb153d 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -241,7 +241,10 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option<u32>, Status
     ("cfg_target_thread_local", "1.7.0", Some(29594), Active),
 
     // rustc internal
-    ("abi_vectorcall", "1.7.0", None, Active)
+    ("abi_vectorcall", "1.7.0", None, Active),
+
+    // a...b and ...b
+    ("inclusive_range_syntax", "1.7.0", Some(28237), Active),
 ];
 // (changing above list without updating src/doc/reference.md makes @cmr sad)
 
@@ -549,6 +552,7 @@ pub struct Features {
     pub allow_placement_in: bool,
     pub allow_box: bool,
     pub allow_pushpop_unsafe: bool,
+    pub allow_inclusive_range: bool,
     pub simd_ffi: bool,
     pub unmarked_api: bool,
     /// spans of #![feature] attrs for stable language features. for error reporting
@@ -585,6 +589,7 @@ impl Features {
             allow_placement_in: false,
             allow_box: false,
             allow_pushpop_unsafe: false,
+            allow_inclusive_range: false,
             simd_ffi: false,
             unmarked_api: false,
             declared_stable_lang_features: Vec::new(),
@@ -998,6 +1003,11 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
                 self.gate_feature("type_ascription", e.span,
                                   "type ascription is experimental");
             }
+            ast::ExprRange(_, _, ast::RangeLimits::Closed) => {
+                self.gate_feature("inclusive_range_syntax",
+                                  e.span,
+                                  "inclusive range syntax is experimental");
+            }
             _ => {}
         }
         visit::walk_expr(self, e);
@@ -1184,6 +1194,7 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &Handler,
         allow_placement_in: cx.has_feature("placement_in_syntax"),
         allow_box: cx.has_feature("box_syntax"),
         allow_pushpop_unsafe: cx.has_feature("pushpop_unsafe"),
+        allow_inclusive_range: cx.has_feature("inclusive_range_syntax"),
         simd_ffi: cx.has_feature("simd_ffi"),
         unmarked_api: cx.has_feature("unmarked_api"),
         declared_stable_lang_features: accepted_features,