about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-01-28 03:19:29 +0800
committerkennytm <kennytm@gmail.com>2018-03-15 16:58:02 +0800
commit92d1f8d8e4be62e6f4dc32bc57f9d44f53117ec9 (patch)
tree61eeb58e84dcb4a8e85640fd50e1ad04e6c017ea /src
parentb5913f2e7695ad247078619bf4c6a6d3dc4dece5 (diff)
downloadrust-92d1f8d8e4be62e6f4dc32bc57f9d44f53117ec9.tar.gz
rust-92d1f8d8e4be62e6f4dc32bc57f9d44f53117ec9.zip
Stabilize `inclusive_range_syntax` language feature.
Stabilize the syntax `a..=b` and `..=b`.
Diffstat (limited to 'src')
-rw-r--r--src/doc/unstable-book/src/language-features/inclusive-range-syntax.md20
-rw-r--r--src/liballoc/tests/lib.rs2
-rw-r--r--src/libcore/lib.rs2
-rw-r--r--src/libcore/ops/range.rs19
-rw-r--r--src/libcore/tests/lib.rs2
-rw-r--r--src/librustc/lib.rs2
-rw-r--r--src/librustc_incremental/lib.rs2
-rw-r--r--src/librustc_mir/lib.rs2
-rw-r--r--src/librustc_trans/lib.rs2
-rw-r--r--src/libsyntax/diagnostic_list.rs4
-rw-r--r--src/libsyntax/feature_gate.rs10
-rw-r--r--src/test/incremental/hashes/indexing_expressions.rs1
-rw-r--r--src/test/parse-fail/range_inclusive.rs2
-rw-r--r--src/test/parse-fail/range_inclusive_dotdotdot.rs2
-rw-r--r--src/test/parse-fail/range_inclusive_gate.rs74
-rw-r--r--src/test/run-pass/range_inclusive.rs2
-rw-r--r--src/test/run-pass/range_inclusive_gate.rs3
-rw-r--r--src/test/ui/impossible_range.rs2
-rw-r--r--src/test/ui/impossible_range.stderr4
19 files changed, 19 insertions, 138 deletions
diff --git a/src/doc/unstable-book/src/language-features/inclusive-range-syntax.md b/src/doc/unstable-book/src/language-features/inclusive-range-syntax.md
deleted file mode 100644
index 56f58803150..00000000000
--- a/src/doc/unstable-book/src/language-features/inclusive-range-syntax.md
+++ /dev/null
@@ -1,20 +0,0 @@
-# `inclusive_range_syntax`
-
-The tracking issue for this feature is: [#28237]
-
-[#28237]: https://github.com/rust-lang/rust/issues/28237
-
-------------------------
-
-To get a range that goes from 0 to 10 and includes the value 10, you
-can write `0..=10`:
-
-```rust
-#![feature(inclusive_range_syntax)]
-
-fn main() {
-    for i in 0..=10 {
-        println!("{}", i);
-    }
-}
-```
diff --git a/src/liballoc/tests/lib.rs b/src/liballoc/tests/lib.rs
index 168dbb2ce9b..f5deecd47e8 100644
--- a/src/liballoc/tests/lib.rs
+++ b/src/liballoc/tests/lib.rs
@@ -14,7 +14,7 @@
 #![feature(alloc_system)]
 #![feature(attr_literals)]
 #![feature(box_syntax)]
-#![feature(inclusive_range_syntax)]
+#![cfg_attr(stage0, feature(inclusive_range_syntax))]
 #![feature(collection_placement)]
 #![feature(const_fn)]
 #![feature(drain_filter)]
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index a947c9f0b7c..9aebe2e4ee4 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -79,7 +79,7 @@
 #![feature(fn_must_use)]
 #![feature(fundamental)]
 #![feature(i128_type)]
-#![feature(inclusive_range_syntax)]
+#![cfg_attr(stage0, feature(inclusive_range_syntax))]
 #![feature(intrinsics)]
 #![feature(iterator_flatten)]
 #![feature(iterator_repeat_with)]
diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs
index 9bdd8094f61..32aa6508805 100644
--- a/src/libcore/ops/range.rs
+++ b/src/libcore/ops/range.rs
@@ -128,7 +128,7 @@ impl<Idx: PartialOrd<Idx>> Range<Idx> {
     /// The range is empty if either side is incomparable:
     ///
     /// ```
-    /// #![feature(range_is_empty,inclusive_range_syntax)]
+    /// #![feature(range_is_empty)]
     ///
     /// use std::f32::NAN;
     /// assert!(!(3.0..5.0).is_empty());
@@ -283,8 +283,6 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> {
 /// # Examples
 ///
 /// ```
-/// #![feature(inclusive_range_syntax)]
-///
 /// assert_eq!((3..=5), std::ops::RangeInclusive { start: 3, end: 5 });
 /// assert_eq!(3 + 4 + 5, (3..=5).sum());
 ///
@@ -316,7 +314,7 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
     /// # Examples
     ///
     /// ```
-    /// #![feature(range_contains,inclusive_range_syntax)]
+    /// #![feature(range_contains)]
     ///
     /// assert!(!(3..=5).contains(2));
     /// assert!( (3..=5).contains(3));
@@ -337,7 +335,7 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
     /// # Examples
     ///
     /// ```
-    /// #![feature(range_is_empty,inclusive_range_syntax)]
+    /// #![feature(range_is_empty)]
     ///
     /// assert!(!(3..=5).is_empty());
     /// assert!(!(3..=3).is_empty());
@@ -347,7 +345,7 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
     /// The range is empty if either side is incomparable:
     ///
     /// ```
-    /// #![feature(range_is_empty,inclusive_range_syntax)]
+    /// #![feature(range_is_empty)]
     ///
     /// use std::f32::NAN;
     /// assert!(!(3.0..=5.0).is_empty());
@@ -358,7 +356,7 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
     /// This method returns `true` after iteration has finished:
     ///
     /// ```
-    /// #![feature(range_is_empty,inclusive_range_syntax)]
+    /// #![feature(range_is_empty)]
     ///
     /// let mut r = 3..=5;
     /// for _ in r.by_ref() {}
@@ -381,7 +379,6 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
 /// The `..=end` syntax is a `RangeToInclusive`:
 ///
 /// ```
-/// #![feature(inclusive_range_syntax)]
 /// assert_eq!((..=5), std::ops::RangeToInclusive{ end: 5 });
 /// ```
 ///
@@ -389,8 +386,6 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
 /// `for` loop directly. This won't compile:
 ///
 /// ```compile_fail,E0277
-/// #![feature(inclusive_range_syntax)]
-///
 /// // error[E0277]: the trait bound `std::ops::RangeToInclusive<{integer}>:
 /// // std::iter::Iterator` is not satisfied
 /// for i in ..=5 {
@@ -402,8 +397,6 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
 /// array elements up to and including the index indicated by `end`.
 ///
 /// ```
-/// #![feature(inclusive_range_syntax)]
-///
 /// let arr = [0, 1, 2, 3];
 /// assert_eq!(arr[ ..=2], [0,1,2  ]);  // RangeToInclusive
 /// assert_eq!(arr[1..=2], [  1,2  ]);
@@ -434,7 +427,7 @@ impl<Idx: PartialOrd<Idx>> RangeToInclusive<Idx> {
     /// # Examples
     ///
     /// ```
-    /// #![feature(range_contains,inclusive_range_syntax)]
+    /// #![feature(range_contains)]
     ///
     /// assert!( (..=5).contains(-1_000_000_000));
     /// assert!( (..=5).contains(5));
diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs
index 8f01fbeb30e..85787f38f06 100644
--- a/src/libcore/tests/lib.rs
+++ b/src/libcore/tests/lib.rs
@@ -23,7 +23,7 @@
 #![feature(fmt_internals)]
 #![feature(iterator_step_by)]
 #![feature(i128_type)]
-#![feature(inclusive_range_syntax)]
+#![cfg_attr(stage0, feature(inclusive_range_syntax))]
 #![feature(iterator_try_fold)]
 #![feature(iterator_flatten)]
 #![feature(conservative_impl_trait)]
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index 149ea96b636..ff2e8ea79d3 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -54,7 +54,7 @@
 #![feature(fs_read_write)]
 #![feature(i128)]
 #![feature(i128_type)]
-#![feature(inclusive_range_syntax)]
+#![cfg_attr(stage0, feature(inclusive_range_syntax))]
 #![cfg_attr(windows, feature(libc))]
 #![feature(match_default_bindings)]
 #![feature(macro_lifetime_matcher)]
diff --git a/src/librustc_incremental/lib.rs b/src/librustc_incremental/lib.rs
index 65fbd9d0bf8..d7ccf9d5562 100644
--- a/src/librustc_incremental/lib.rs
+++ b/src/librustc_incremental/lib.rs
@@ -18,7 +18,7 @@
 #![feature(conservative_impl_trait)]
 #![feature(fs_read_write)]
 #![feature(i128_type)]
-#![feature(inclusive_range_syntax)]
+#![cfg_attr(stage0, feature(inclusive_range_syntax))]
 #![feature(specialization)]
 
 extern crate graphviz;
diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs
index 31eb203eefe..ad7a5c94022 100644
--- a/src/librustc_mir/lib.rs
+++ b/src/librustc_mir/lib.rs
@@ -28,7 +28,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
 #![feature(dyn_trait)]
 #![feature(fs_read_write)]
 #![feature(i128_type)]
-#![feature(inclusive_range_syntax)]
+#![cfg_attr(stage0, feature(inclusive_range_syntax))]
 #![feature(macro_vis_matcher)]
 #![feature(match_default_bindings)]
 #![feature(exhaustive_patterns)]
diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs
index a9334461825..f2b76eb57d6 100644
--- a/src/librustc_trans/lib.rs
+++ b/src/librustc_trans/lib.rs
@@ -26,7 +26,7 @@
 #![allow(unused_attributes)]
 #![feature(i128_type)]
 #![feature(i128)]
-#![feature(inclusive_range_syntax)]
+#![cfg_attr(stage0, feature(inclusive_range_syntax))]
 #![feature(libc)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
diff --git a/src/libsyntax/diagnostic_list.rs b/src/libsyntax/diagnostic_list.rs
index 549ef88afcc..1f87c1b94c5 100644
--- a/src/libsyntax/diagnostic_list.rs
+++ b/src/libsyntax/diagnostic_list.rs
@@ -218,8 +218,6 @@ An inclusive range was used with no end.
 Erroneous code example:
 
 ```compile_fail,E0586
-#![feature(inclusive_range_syntax)]
-
 fn main() {
     let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];
     let x = &tmp[1..=]; // error: inclusive range was used with no end
@@ -239,8 +237,6 @@ fn main() {
 Or put an end to your inclusive range:
 
 ```
-#![feature(inclusive_range_syntax)]
-
 fn main() {
     let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1];
     let x = &tmp[1..=3]; // ok!
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 91364fe6ed4..a415117b599 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -268,9 +268,6 @@ declare_features! (
     // rustc internal
     (active, abi_vectorcall, "1.7.0", None, None),
 
-    // a..=b and ..=b
-    (active, inclusive_range_syntax, "1.7.0", Some(28237), None),
-
     // X..Y patterns
     (active, exclusive_range_pattern, "1.11.0", Some(37854), None),
 
@@ -554,6 +551,8 @@ declare_features! (
     (accepted, match_beginning_vert, "1.25.0", Some(44101), None),
     // Nested groups in `use` (RFC 2128)
     (accepted, use_nested_groups, "1.25.0", Some(44494), None),
+    // a..=b and ..=b
+    (accepted, inclusive_range_syntax, "1.26.0", Some(28237), None),
 );
 
 // If you change this, please modify src/doc/unstable-book as well. You must
@@ -1592,11 +1591,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
                 gate_feature_post!(&self, type_ascription, e.span,
                                   "type ascription is experimental");
             }
-            ast::ExprKind::Range(_, _, ast::RangeLimits::Closed) => {
-                gate_feature_post!(&self, inclusive_range_syntax,
-                                  e.span,
-                                  "inclusive range syntax is experimental");
-            }
             ast::ExprKind::InPlace(..) => {
                 gate_feature_post!(&self, placement_in_syntax, e.span, EXPLAIN_PLACEMENT_IN);
             }
diff --git a/src/test/incremental/hashes/indexing_expressions.rs b/src/test/incremental/hashes/indexing_expressions.rs
index e66e239b33c..fb63aa857aa 100644
--- a/src/test/incremental/hashes/indexing_expressions.rs
+++ b/src/test/incremental/hashes/indexing_expressions.rs
@@ -23,7 +23,6 @@
 #![allow(warnings)]
 #![feature(rustc_attrs)]
 #![crate_type="rlib"]
-#![feature(inclusive_range_syntax)]
 
 // Change simple index ---------------------------------------------------------
 #[cfg(cfail1)]
diff --git a/src/test/parse-fail/range_inclusive.rs b/src/test/parse-fail/range_inclusive.rs
index 6c6caa1e649..2aa7d6d6cd7 100644
--- a/src/test/parse-fail/range_inclusive.rs
+++ b/src/test/parse-fail/range_inclusive.rs
@@ -10,8 +10,6 @@
 
 // Make sure that inclusive ranges with no end point don't parse.
 
-#![feature(inclusive_range_syntax)]
-
 pub fn main() {
     for _ in 1..= {} //~ERROR inclusive range with no end
                      //~^HELP bounded at the end
diff --git a/src/test/parse-fail/range_inclusive_dotdotdot.rs b/src/test/parse-fail/range_inclusive_dotdotdot.rs
index 8a24038638b..fa6474717d3 100644
--- a/src/test/parse-fail/range_inclusive_dotdotdot.rs
+++ b/src/test/parse-fail/range_inclusive_dotdotdot.rs
@@ -12,8 +12,6 @@
 
 // Make sure that inclusive ranges with `...` syntax don't parse.
 
-#![feature(inclusive_range_syntax)]
-
 use std::ops::RangeToInclusive;
 
 fn return_range_to() -> RangeToInclusive<i32> {
diff --git a/src/test/parse-fail/range_inclusive_gate.rs b/src/test/parse-fail/range_inclusive_gate.rs
deleted file mode 100644
index c8c84000e41..00000000000
--- a/src/test/parse-fail/range_inclusive_gate.rs
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2016 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.
-
-// gate-test-inclusive_range_syntax
-
-// Make sure that #![feature(inclusive_range_syntax)] is required.
-
-// #![feature(inclusive_range_syntax)]
-
-macro_rules! m {
-    () => { for _ in 1..=10 {} } //~ ERROR inclusive range syntax is experimental
-}
-
-#[cfg(nope)]
-fn f() {}
-#[cfg(not(nope))]
-fn f() {
-    for _ in 1..=10 {} //~ ERROR inclusive range syntax is experimental
-}
-
-#[cfg(nope)]
-macro_rules! n { () => {} }
-#[cfg(not(nope))]
-macro_rules! n {
-    () => { for _ in 1..=10 {} } //~ ERROR inclusive range syntax is experimental
-}
-
-macro_rules! o {
-    () => {{
-        #[cfg(nope)]
-        fn g() {}
-        #[cfg(not(nope))]
-        fn g() {
-            for _ in 1..=10 {} //~ ERROR inclusive range syntax is experimental
-        }
-
-        g();
-    }}
-}
-
-#[cfg(nope)]
-macro_rules! p { () => {} }
-#[cfg(not(nope))]
-macro_rules! p {
-    () => {{
-        #[cfg(nope)]
-        fn h() {}
-        #[cfg(not(nope))]
-        fn h() {
-            for _ in 1..=10 {} //~ ERROR inclusive range syntax is experimental
-        }
-
-        h();
-    }}
-}
-
-pub fn main() {
-    for _ in 1..=10 {} //~ ERROR inclusive range syntax is experimental
-    for _ in ..=10 {} //~ ERROR inclusive range syntax is experimental
-
-    f(); // not allowed in cfg'ed functions
-
-    m!(); // not allowed in macros
-    n!(); // not allowed in cfg'ed macros
-    o!(); // not allowed in macros that output cfgs
-    p!(); // not allowed in cfg'ed macros that output cfgs
-}
diff --git a/src/test/run-pass/range_inclusive.rs b/src/test/run-pass/range_inclusive.rs
index 29947860ff6..5d46bfab887 100644
--- a/src/test/run-pass/range_inclusive.rs
+++ b/src/test/run-pass/range_inclusive.rs
@@ -10,7 +10,7 @@
 
 // Test inclusive range syntax.
 
-#![feature(inclusive_range_syntax, iterator_step_by)]
+#![feature(iterator_step_by)]
 
 use std::ops::{RangeInclusive, RangeToInclusive};
 
diff --git a/src/test/run-pass/range_inclusive_gate.rs b/src/test/run-pass/range_inclusive_gate.rs
index 570087aedbb..6c2731fa5a9 100644
--- a/src/test/run-pass/range_inclusive_gate.rs
+++ b/src/test/run-pass/range_inclusive_gate.rs
@@ -9,8 +9,7 @@
 // except according to those terms.
 
 // Test that you only need the syntax gate if you don't mention the structs.
-
-#![feature(inclusive_range_syntax)]
+// (Obsoleted since both features are stabilized)
 
 fn main() {
     let mut count = 0;
diff --git a/src/test/ui/impossible_range.rs b/src/test/ui/impossible_range.rs
index 5c72c506e6b..073ed867bdb 100644
--- a/src/test/ui/impossible_range.rs
+++ b/src/test/ui/impossible_range.rs
@@ -10,8 +10,6 @@
 
 // Make sure that invalid ranges generate an error during HIR lowering, not an ICE
 
-#![feature(inclusive_range_syntax)]
-
 pub fn main() {
     ..;
     0..;
diff --git a/src/test/ui/impossible_range.stderr b/src/test/ui/impossible_range.stderr
index d941b522def..cfeaa53a6bb 100644
--- a/src/test/ui/impossible_range.stderr
+++ b/src/test/ui/impossible_range.stderr
@@ -1,5 +1,5 @@
 error[E0586]: inclusive range with no end
-  --> $DIR/impossible_range.rs:20:8
+  --> $DIR/impossible_range.rs:18:8
    |
 LL |     ..=; //~ERROR inclusive range with no end
    |        ^
@@ -7,7 +7,7 @@ LL |     ..=; //~ERROR inclusive range with no end
    = help: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
 
 error[E0586]: inclusive range with no end
-  --> $DIR/impossible_range.rs:27:9
+  --> $DIR/impossible_range.rs:25:9
    |
 LL |     0..=; //~ERROR inclusive range with no end
    |         ^