Skip to content

Commit 37a4cb3

Browse files
committed
feature-gate inclusive range syntax
1 parent bd3197c commit 37a4cb3

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/libsyntax/feature_gate.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,10 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option<u32>, Status
241241
("cfg_target_thread_local", "1.7.0", Some(29594), Active),
242242

243243
// rustc internal
244-
("abi_vectorcall", "1.7.0", None, Active)
244+
("abi_vectorcall", "1.7.0", None, Active),
245+
246+
// a...b and ...b
247+
("inclusive_range_syntax", "1.7.0", Some(28237), Active),
245248
];
246249
// (changing above list without updating src/doc/reference.md makes @cmr sad)
247250

@@ -549,6 +552,7 @@ pub struct Features {
549552
pub allow_placement_in: bool,
550553
pub allow_box: bool,
551554
pub allow_pushpop_unsafe: bool,
555+
pub allow_inclusive_range: bool,
552556
pub simd_ffi: bool,
553557
pub unmarked_api: bool,
554558
/// spans of #![feature] attrs for stable language features. for error reporting
@@ -585,6 +589,7 @@ impl Features {
585589
allow_placement_in: false,
586590
allow_box: false,
587591
allow_pushpop_unsafe: false,
592+
allow_inclusive_range: false,
588593
simd_ffi: false,
589594
unmarked_api: false,
590595
declared_stable_lang_features: Vec::new(),
@@ -998,6 +1003,11 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
9981003
self.gate_feature("type_ascription", e.span,
9991004
"type ascription is experimental");
10001005
}
1006+
ast::ExprRange(_, _, ast::RangeLimits::Closed) => {
1007+
self.gate_feature("inclusive_range_syntax",
1008+
e.span,
1009+
"inclusive range syntax is experimental");
1010+
}
10011011
_ => {}
10021012
}
10031013
visit::walk_expr(self, e);
@@ -1184,6 +1194,7 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &Handler,
11841194
allow_placement_in: cx.has_feature("placement_in_syntax"),
11851195
allow_box: cx.has_feature("box_syntax"),
11861196
allow_pushpop_unsafe: cx.has_feature("pushpop_unsafe"),
1197+
allow_inclusive_range: cx.has_feature("inclusive_range_syntax"),
11871198
simd_ffi: cx.has_feature("simd_ffi"),
11881199
unmarked_api: cx.has_feature("unmarked_api"),
11891200
declared_stable_lang_features: accepted_features,

0 commit comments

Comments
 (0)