summary refs log tree commit diff
path: root/src/libcore
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/libcore
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/libcore')
-rw-r--r--src/libcore/lib.rs2
-rw-r--r--src/libcore/ops/range.rs19
-rw-r--r--src/libcore/tests/lib.rs2
3 files changed, 8 insertions, 15 deletions
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)]