From edad2eff0c0587cd0b9d4b46f11579ef43388be8 Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 14 May 2018 23:25:22 +0100 Subject: [PATCH 1/3] Stabilise inclusive_range_methods --- src/liballoc/tests/lib.rs | 1 - src/libcore/ops/range.rs | 13 +++---------- src/libcore/tests/lib.rs | 1 - src/librustc/lib.rs | 1 - src/librustc_codegen_llvm/lib.rs | 1 - src/librustc_mir/lib.rs | 1 - src/librustc_target/lib.rs | 1 - 7 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/liballoc/tests/lib.rs b/src/liballoc/tests/lib.rs index 1c8ff316e55aa..081c473768f1f 100644 --- a/src/liballoc/tests/lib.rs +++ b/src/liballoc/tests/lib.rs @@ -25,7 +25,6 @@ #![feature(try_reserve)] #![feature(unboxed_closures)] #![feature(exact_chunks)] -#![feature(inclusive_range_methods)] extern crate alloc_system; extern crate core; diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index 1f84631ada3a1..70da5fcda0095 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -318,8 +318,6 @@ impl> RangeTo { /// # Examples /// /// ``` -/// #![feature(inclusive_range_methods)] -/// /// assert_eq!((3..=5), std::ops::RangeInclusive::new(3, 5)); /// assert_eq!(3 + 4 + 5, (3..=5).sum()); /// @@ -345,12 +343,11 @@ impl RangeInclusive { /// # Examples /// /// ``` - /// #![feature(inclusive_range_methods)] /// use std::ops::RangeInclusive; /// /// assert_eq!(3..=5, RangeInclusive::new(3, 5)); /// ``` - #[unstable(feature = "inclusive_range_methods", issue = "49022")] + #[stable(feature = "inclusive_range_methods", since = "1.27.0")] #[inline] pub const fn new(start: Idx, end: Idx) -> Self { Self { start, end } @@ -369,11 +366,9 @@ impl RangeInclusive { /// # Examples /// /// ``` - /// #![feature(inclusive_range_methods)] - /// /// assert_eq!((3..=5).start(), &3); /// ``` - #[unstable(feature = "inclusive_range_methods", issue = "49022")] + #[stable(feature = "inclusive_range_methods", since = "1.27.0")] #[inline] pub fn start(&self) -> &Idx { &self.start @@ -392,11 +387,9 @@ impl RangeInclusive { /// # Examples /// /// ``` - /// #![feature(inclusive_range_methods)] - /// /// assert_eq!((3..=5).end(), &5); /// ``` - #[unstable(feature = "inclusive_range_methods", issue = "49022")] + #[stable(feature = "inclusive_range_methods", since = "1.27.0")] #[inline] pub fn end(&self) -> &Idx { &self.end diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 8c481338945ff..cd6b5c6a4ad4c 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -42,7 +42,6 @@ #![feature(try_trait)] #![feature(exact_chunks)] #![feature(reverse_bits)] -#![feature(inclusive_range_methods)] #![feature(iterator_find_map)] #![feature(slice_internals)] diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index bbd684982fa41..1d53a305193fa 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -68,7 +68,6 @@ #![feature(trusted_len)] #![feature(catch_expr)] #![feature(test)] -#![feature(inclusive_range_methods)] #![recursion_limit="512"] diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index bd053da4bd303..0b0bab96dfdfd 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -29,7 +29,6 @@ #![feature(rustc_diagnostic_macros)] #![feature(slice_sort_by_cached_key)] #![feature(optin_builtin_traits)] -#![feature(inclusive_range_methods)] use rustc::dep_graph::WorkProduct; use syntax_pos::symbol::Symbol; diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index d9b6c406e2012..3bf9453fb513c 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -29,7 +29,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment! #![feature(exhaustive_patterns)] #![feature(range_contains)] #![feature(rustc_diagnostic_macros)] -#![feature(inclusive_range_methods)] #![feature(crate_visibility_modifier)] #![feature(never_type)] #![feature(specialization)] diff --git a/src/librustc_target/lib.rs b/src/librustc_target/lib.rs index 45f2ee13bbdc9..8f4911574398b 100644 --- a/src/librustc_target/lib.rs +++ b/src/librustc_target/lib.rs @@ -29,7 +29,6 @@ #![feature(const_fn)] #![feature(fs_read_write)] #![feature(inclusive_range)] -#![feature(inclusive_range_methods)] #![feature(slice_patterns)] #[macro_use] From 1b3ecbcebb38e06495819324f2a67f1d0eb24a23 Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 14 May 2018 23:31:20 +0100 Subject: [PATCH 2/3] Stabilise into_inner --- src/libcore/ops/range.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index 70da5fcda0095..6f2a08999bc5c 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -400,11 +400,9 @@ impl RangeInclusive { /// # Examples /// /// ``` - /// #![feature(inclusive_range_methods)] - /// /// assert_eq!((3..=5).into_inner(), (3, 5)); /// ``` - #[unstable(feature = "inclusive_range_methods", issue = "49022")] + #[stable(feature = "inclusive_range_methods", since = "1.27.0")] #[inline] pub fn into_inner(self) -> (Idx, Idx) { (self.start, self.end) From ff0f00d3182cd604d2d40ea0fe75a4bca407c6b9 Mon Sep 17 00:00:00 2001 From: varkor Date: Wed, 16 May 2018 21:19:17 +0100 Subject: [PATCH 3/3] Add doc comments mentioning unspecified behaviour upon exhaustion --- src/libcore/ops/range.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index 6f2a08999bc5c..7c6e2447bdb7f 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -360,6 +360,9 @@ impl RangeInclusive { /// whether the inclusive range is empty, use the [`is_empty()`] method /// instead of comparing `start() > end()`. /// + /// Note: the value returned by this method is unspecified after the range + /// has been iterated to exhaustion. + /// /// [`end()`]: #method.end /// [`is_empty()`]: #method.is_empty /// @@ -381,6 +384,9 @@ impl RangeInclusive { /// whether the inclusive range is empty, use the [`is_empty()`] method /// instead of comparing `start() > end()`. /// + /// Note: the value returned by this method is unspecified after the range + /// has been iterated to exhaustion. + /// /// [`start()`]: #method.start /// [`is_empty()`]: #method.is_empty /// @@ -395,7 +401,10 @@ impl RangeInclusive { &self.end } - /// Destructures the RangeInclusive into (lower bound, upper (inclusive) bound). + /// Destructures the `RangeInclusive` into (lower bound, upper (inclusive) bound). + /// + /// Note: the value returned by this method is unspecified after the range + /// has been iterated to exhaustion. /// /// # Examples ///