From edc412c5a9ce825d589dcb87dd6028b072139b51 Mon Sep 17 00:00:00 2001 From: tinaun Date: Tue, 17 Apr 2018 00:30:06 -0400 Subject: [PATCH 1/7] stabilize `slice_rsplit` feature --- .../src/library-features/slice-rsplit.md | 10 ------- src/liballoc/lib.rs | 1 - src/liballoc/slice.rs | 11 ++------ src/libcore/slice/mod.rs | 28 +++++++++---------- 4 files changed, 17 insertions(+), 33 deletions(-) delete mode 100644 src/doc/unstable-book/src/library-features/slice-rsplit.md diff --git a/src/doc/unstable-book/src/library-features/slice-rsplit.md b/src/doc/unstable-book/src/library-features/slice-rsplit.md deleted file mode 100644 index 8c2954f7294e0..0000000000000 --- a/src/doc/unstable-book/src/library-features/slice-rsplit.md +++ /dev/null @@ -1,10 +0,0 @@ -# `slice_rsplit` - -The tracking issue for this feature is: [#41020] - -[#41020]: https://github.com/rust-lang/rust/issues/41020 - ------------------------- - -The `slice_rsplit` feature enables two methods on slices: -`slice.rsplit(predicate)` and `slice.rsplit_mut(predicate)`. diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 3a106a2ff5c3d..87ad2751c5b78 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -108,7 +108,6 @@ #![feature(ptr_offset_from)] #![feature(rustc_attrs)] #![feature(slice_get_slice)] -#![feature(slice_rsplit)] #![feature(specialization)] #![feature(staged_api)] #![feature(str_internals)] diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index 56c53fca62cb1..eb8a293013d9e 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -116,7 +116,7 @@ pub use core::slice::{Iter, IterMut}; pub use core::slice::{SplitMut, ChunksMut, Split}; #[stable(feature = "rust1", since = "1.0.0")] pub use core::slice::{SplitN, RSplitN, SplitNMut, RSplitNMut}; -#[unstable(feature = "slice_rsplit", issue = "41020")] +#[stable(feature = "slice_rsplit", since = "1.27.0")] pub use core::slice::{RSplit, RSplitMut}; #[stable(feature = "rust1", since = "1.0.0")] pub use core::slice::{from_raw_parts, from_raw_parts_mut}; @@ -888,7 +888,6 @@ impl [T] { /// # Examples /// /// ``` - /// #![feature(slice_rsplit)] /// /// let slice = [11, 22, 33, 0, 44, 55]; /// let mut iter = slice.rsplit(|num| *num == 0); @@ -902,8 +901,6 @@ impl [T] { /// slice will be the first (or last) item returned by the iterator. /// /// ``` - /// #![feature(slice_rsplit)] - /// /// let v = &[0, 1, 1, 2, 3, 5, 8]; /// let mut it = v.rsplit(|n| *n % 2 == 0); /// assert_eq!(it.next().unwrap(), &[]); @@ -912,7 +909,7 @@ impl [T] { /// assert_eq!(it.next().unwrap(), &[]); /// assert_eq!(it.next(), None); /// ``` - #[unstable(feature = "slice_rsplit", issue = "41020")] + #[stable(feature = "slice_rsplit", since = "1.27.0")] #[inline] pub fn rsplit(&self, pred: F) -> RSplit where F: FnMut(&T) -> bool @@ -927,8 +924,6 @@ impl [T] { /// # Examples /// /// ``` - /// #![feature(slice_rsplit)] - /// /// let mut v = [100, 400, 300, 200, 600, 500]; /// /// let mut count = 0; @@ -939,7 +934,7 @@ impl [T] { /// assert_eq!(v, [3, 400, 300, 2, 600, 1]); /// ``` /// - #[unstable(feature = "slice_rsplit", issue = "41020")] + #[stable(feature = "slice_rsplit", since = "1.27.0")] #[inline] pub fn rsplit_mut(&mut self, pred: F) -> RSplitMut where F: FnMut(&T) -> bool diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index 0a22028da81f4..68f081c2e879c 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -86,7 +86,7 @@ pub trait SliceExt { fn split

(&self, pred: P) -> Split where P: FnMut(&Self::Item) -> bool; - #[unstable(feature = "slice_rsplit", issue = "41020")] + #[stable(feature = "slice_rsplit", since = "1.27.0")] fn rsplit

(&self, pred: P) -> RSplit where P: FnMut(&Self::Item) -> bool; @@ -169,7 +169,7 @@ pub trait SliceExt { fn split_mut

(&mut self, pred: P) -> SplitMut where P: FnMut(&Self::Item) -> bool; - #[unstable(feature = "slice_rsplit", issue = "41020")] + #[stable(feature = "slice_rsplit", since = "1.27.0")] fn rsplit_mut

(&mut self, pred: P) -> RSplitMut where P: FnMut(&Self::Item) -> bool; @@ -1840,13 +1840,13 @@ impl<'a, T, P> FusedIterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool { /// /// [`rsplit`]: ../../std/primitive.slice.html#method.rsplit /// [slices]: ../../std/primitive.slice.html -#[unstable(feature = "slice_rsplit", issue = "41020")] +#[stable(feature = "slice_rsplit", since = "1.27.0")] #[derive(Clone)] // Is this correct, or does it incorrectly require `T: Clone`? pub struct RSplit<'a, T:'a, P> where P: FnMut(&T) -> bool { inner: Split<'a, T, P> } -#[unstable(feature = "slice_rsplit", issue = "41020")] +#[stable(feature = "slice_rsplit", since = "1.27.0")] impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for RSplit<'a, T, P> where P: FnMut(&T) -> bool { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("RSplit") @@ -1856,7 +1856,7 @@ impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for RSplit<'a, T, P> where P: FnMut(& } } -#[unstable(feature = "slice_rsplit", issue = "41020")] +#[stable(feature = "slice_rsplit", since = "1.27.0")] impl<'a, T, P> Iterator for RSplit<'a, T, P> where P: FnMut(&T) -> bool { type Item = &'a [T]; @@ -1871,7 +1871,7 @@ impl<'a, T, P> Iterator for RSplit<'a, T, P> where P: FnMut(&T) -> bool { } } -#[unstable(feature = "slice_rsplit", issue = "41020")] +#[stable(feature = "slice_rsplit", since = "1.27.0")] impl<'a, T, P> DoubleEndedIterator for RSplit<'a, T, P> where P: FnMut(&T) -> bool { #[inline] fn next_back(&mut self) -> Option<&'a [T]> { @@ -1879,7 +1879,7 @@ impl<'a, T, P> DoubleEndedIterator for RSplit<'a, T, P> where P: FnMut(&T) -> bo } } -#[unstable(feature = "slice_rsplit", issue = "41020")] +#[stable(feature = "slice_rsplit", since = "1.27.0")] impl<'a, T, P> SplitIter for RSplit<'a, T, P> where P: FnMut(&T) -> bool { #[inline] fn finish(&mut self) -> Option<&'a [T]> { @@ -1887,7 +1887,7 @@ impl<'a, T, P> SplitIter for RSplit<'a, T, P> where P: FnMut(&T) -> bool { } } -#[unstable(feature = "slice_rsplit", issue = "41020")] +#[stable(feature = "slice_rsplit", since = "1.27.0")] impl<'a, T, P> FusedIterator for RSplit<'a, T, P> where P: FnMut(&T) -> bool {} /// An iterator over the subslices of the vector which are separated @@ -1897,12 +1897,12 @@ impl<'a, T, P> FusedIterator for RSplit<'a, T, P> where P: FnMut(&T) -> bool {} /// /// [`rsplit_mut`]: ../../std/primitive.slice.html#method.rsplit_mut /// [slices]: ../../std/primitive.slice.html -#[unstable(feature = "slice_rsplit", issue = "41020")] +#[stable(feature = "slice_rsplit", since = "1.27.0")] pub struct RSplitMut<'a, T:'a, P> where P: FnMut(&T) -> bool { inner: SplitMut<'a, T, P> } -#[unstable(feature = "slice_rsplit", issue = "41020")] +#[stable(feature = "slice_rsplit", since = "1.27.0")] impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for RSplitMut<'a, T, P> where P: FnMut(&T) -> bool { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("RSplitMut") @@ -1912,7 +1912,7 @@ impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for RSplitMut<'a, T, P> where P: FnMu } } -#[unstable(feature = "slice_rsplit", issue = "41020")] +#[stable(feature = "slice_rsplit", since = "1.27.0")] impl<'a, T, P> SplitIter for RSplitMut<'a, T, P> where P: FnMut(&T) -> bool { #[inline] fn finish(&mut self) -> Option<&'a mut [T]> { @@ -1920,7 +1920,7 @@ impl<'a, T, P> SplitIter for RSplitMut<'a, T, P> where P: FnMut(&T) -> bool { } } -#[unstable(feature = "slice_rsplit", issue = "41020")] +#[stable(feature = "slice_rsplit", since = "1.27.0")] impl<'a, T, P> Iterator for RSplitMut<'a, T, P> where P: FnMut(&T) -> bool { type Item = &'a mut [T]; @@ -1935,7 +1935,7 @@ impl<'a, T, P> Iterator for RSplitMut<'a, T, P> where P: FnMut(&T) -> bool { } } -#[unstable(feature = "slice_rsplit", issue = "41020")] +#[stable(feature = "slice_rsplit", since = "1.27.0")] impl<'a, T, P> DoubleEndedIterator for RSplitMut<'a, T, P> where P: FnMut(&T) -> bool, { @@ -1945,7 +1945,7 @@ impl<'a, T, P> DoubleEndedIterator for RSplitMut<'a, T, P> where } } -#[unstable(feature = "slice_rsplit", issue = "41020")] +#[stable(feature = "slice_rsplit", since = "1.27.0")] impl<'a, T, P> FusedIterator for RSplitMut<'a, T, P> where P: FnMut(&T) -> bool {} /// An private iterator over subslices separated by elements that From 41c211d2043df20b2ff5c9a13f8c7d711f74c13a Mon Sep 17 00:00:00 2001 From: tinaun Date: Tue, 17 Apr 2018 00:36:13 -0400 Subject: [PATCH 2/7] stabilize `swap_nonoverlapping` feature --- src/libcore/ptr.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 4a7d7c410eb16..f953b29fdc817 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -166,8 +166,6 @@ pub unsafe fn swap(x: *mut T, y: *mut T) { /// Basic usage: /// /// ``` -/// #![feature(swap_nonoverlapping)] -/// /// use std::ptr; /// /// let mut x = [1, 2, 3, 4]; @@ -181,7 +179,7 @@ pub unsafe fn swap(x: *mut T, y: *mut T) { /// assert_eq!(y, [1, 2, 9]); /// ``` #[inline] -#[unstable(feature = "swap_nonoverlapping", issue = "42818")] +#[stable(feature = "swap_nonoverlapping", since = "1.27.0")] pub unsafe fn swap_nonoverlapping(x: *mut T, y: *mut T, count: usize) { let x = x as *mut u8; let y = y as *mut u8; From 78a8c257032b18b5ca63f41b18d2fe7d57d1cffa Mon Sep 17 00:00:00 2001 From: tinaun Date: Tue, 17 Apr 2018 00:40:07 -0400 Subject: [PATCH 3/7] stabilize `swap_with_slice` feature --- src/liballoc/lib.rs | 2 +- src/liballoc/slice.rs | 8 +------- src/libcore/slice/mod.rs | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 87ad2751c5b78..f2a61bda4aa84 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -123,7 +123,7 @@ #![feature(inclusive_range_fields)] #![cfg_attr(stage0, feature(generic_param_attrs))] -#![cfg_attr(not(test), feature(fn_traits, swap_with_slice, i128))] +#![cfg_attr(not(test), feature(fn_traits, i128))] #![cfg_attr(test, feature(test))] // Allow testing this library diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index eb8a293013d9e..33e652856e816 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -1702,8 +1702,6 @@ impl [T] { /// Swapping two elements across slices: /// /// ``` - /// #![feature(swap_with_slice)] - /// /// let mut slice1 = [0, 0]; /// let mut slice2 = [1, 2, 3, 4]; /// @@ -1719,8 +1717,6 @@ impl [T] { /// a compile failure: /// /// ```compile_fail - /// #![feature(swap_with_slice)] - /// /// let mut slice = [1, 2, 3, 4, 5]; /// slice[..2].swap_with_slice(&mut slice[3..]); // compile fail! /// ``` @@ -1729,8 +1725,6 @@ impl [T] { /// mutable sub-slices from a slice: /// /// ``` - /// #![feature(swap_with_slice)] - /// /// let mut slice = [1, 2, 3, 4, 5]; /// /// { @@ -1742,7 +1736,7 @@ impl [T] { /// ``` /// /// [`split_at_mut`]: #method.split_at_mut - #[unstable(feature = "swap_with_slice", issue = "44030")] + #[stable(feature = "swap_with_slice", since = "1.27.0")] pub fn swap_with_slice(&mut self, other: &mut [T]) { core_slice::SliceExt::swap_with_slice(self, other) } diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index 68f081c2e879c..afb149f29977c 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -223,7 +223,7 @@ pub trait SliceExt { #[stable(feature = "copy_from_slice", since = "1.9.0")] fn copy_from_slice(&mut self, src: &[Self::Item]) where Self::Item: Copy; - #[unstable(feature = "swap_with_slice", issue = "44030")] + #[stable(feature = "swap_with_slice", since = "1.27.0")] fn swap_with_slice(&mut self, src: &mut [Self::Item]); #[stable(feature = "sort_unstable", since = "1.20.0")] From 335195d6280cbf6d30d4a56df77142423afee264 Mon Sep 17 00:00:00 2001 From: tinaun Date: Tue, 17 Apr 2018 00:43:48 -0400 Subject: [PATCH 4/7] stabilize `duration_from_micros` feature --- src/libcore/time.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libcore/time.rs b/src/libcore/time.rs index b8d0719b9b992..e71a8f5da638d 100644 --- a/src/libcore/time.rs +++ b/src/libcore/time.rs @@ -137,7 +137,6 @@ impl Duration { /// # Examples /// /// ``` - /// #![feature(duration_from_micros)] /// use std::time::Duration; /// /// let duration = Duration::from_micros(1_000_002); @@ -145,7 +144,7 @@ impl Duration { /// assert_eq!(1, duration.as_secs()); /// assert_eq!(2000, duration.subsec_nanos()); /// ``` - #[unstable(feature = "duration_from_micros", issue = "44400")] + #[stable(feature = "duration_from_micros", since = "1.27.0")] #[inline] pub const fn from_micros(micros: u64) -> Duration { Duration { From 4a8f4b7e4958f5a57ca2ebb936a2f6770191eebd Mon Sep 17 00:00:00 2001 From: tinaun Date: Tue, 17 Apr 2018 00:56:20 -0400 Subject: [PATCH 5/7] stabilize `duration_extras` feature --- src/libcore/time.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/libcore/time.rs b/src/libcore/time.rs index e71a8f5da638d..e22fe450bb1f6 100644 --- a/src/libcore/time.rs +++ b/src/libcore/time.rs @@ -158,7 +158,6 @@ impl Duration { /// # Examples /// /// ``` - /// #![feature(duration_extras)] /// use std::time::Duration; /// /// let duration = Duration::from_nanos(1_000_000_123); @@ -166,7 +165,7 @@ impl Duration { /// assert_eq!(1, duration.as_secs()); /// assert_eq!(123, duration.subsec_nanos()); /// ``` - #[unstable(feature = "duration_extras", issue = "46507")] + #[stable(feature = "duration_extras", since = "1.27.0")] #[inline] pub const fn from_nanos(nanos: u64) -> Duration { Duration { @@ -216,14 +215,13 @@ impl Duration { /// # Examples /// /// ``` - /// #![feature(duration_extras)] /// use std::time::Duration; /// /// let duration = Duration::from_millis(5432); /// assert_eq!(duration.as_secs(), 5); /// assert_eq!(duration.subsec_millis(), 432); /// ``` - #[unstable(feature = "duration_extras", issue = "46507")] + #[stable(feature = "duration_extras", since = "1.27.0")] #[inline] pub fn subsec_millis(&self) -> u32 { self.nanos / NANOS_PER_MILLI } @@ -236,14 +234,13 @@ impl Duration { /// # Examples /// /// ``` - /// #![feature(duration_extras, duration_from_micros)] /// use std::time::Duration; /// /// let duration = Duration::from_micros(1_234_567); /// assert_eq!(duration.as_secs(), 1); /// assert_eq!(duration.subsec_micros(), 234_567); /// ``` - #[unstable(feature = "duration_extras", issue = "46507")] + #[stable(feature = "duration_extras", since = "1.27.0")] #[inline] pub fn subsec_micros(&self) -> u32 { self.nanos / NANOS_PER_MICRO } From b84baf23788e96a1d79de543eb264ff7d2334c63 Mon Sep 17 00:00:00 2001 From: tinaun Date: Tue, 17 Apr 2018 00:59:16 -0400 Subject: [PATCH 6/7] stabilize `nonnull_cast` feature --- src/liballoc/lib.rs | 1 - src/libcore/ptr.rs | 2 +- src/libstd/lib.rs | 1 - src/test/run-pass/realloc-16687.rs | 2 +- 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index f2a61bda4aa84..163aef61b4362 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -99,7 +99,6 @@ #![feature(lang_items)] #![feature(libc)] #![feature(needs_allocator)] -#![feature(nonnull_cast)] #![feature(nonzero)] #![feature(optin_builtin_traits)] #![feature(pattern)] diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index f953b29fdc817..74bb264cc679c 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -2742,7 +2742,7 @@ impl NonNull { } /// Cast to a pointer of another type - #[unstable(feature = "nonnull_cast", issue = "47653")] + #[stable(feature = "nonnull_cast", since = "1.27.0")] pub fn cast(self) -> NonNull { unsafe { NonNull::new_unchecked(self.as_ptr() as *mut U) diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index dd96c57538c79..63e4a17d32e75 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -275,7 +275,6 @@ #![feature(macro_reexport)] #![feature(macro_vis_matcher)] #![feature(needs_panic_runtime)] -#![feature(nonnull_cast)] #![feature(exhaustive_patterns)] #![feature(nonzero)] #![feature(num_bits_bytes)] diff --git a/src/test/run-pass/realloc-16687.rs b/src/test/run-pass/realloc-16687.rs index 38cc23c16a976..afa3494c38919 100644 --- a/src/test/run-pass/realloc-16687.rs +++ b/src/test/run-pass/realloc-16687.rs @@ -13,7 +13,7 @@ // Ideally this would be revised to use no_std, but for now it serves // well enough to reproduce (and illustrate) the bug from #16687. -#![feature(heap_api, allocator_api, nonnull_cast)] +#![feature(heap_api, allocator_api)] use std::alloc::{Global, Alloc, Layout}; use std::ptr::{self, NonNull}; From fd042eee0002bc2640447c08034de00171ca1aa3 Mon Sep 17 00:00:00 2001 From: tinaun Date: Tue, 17 Apr 2018 01:06:29 -0400 Subject: [PATCH 7/7] stabilize `hash_map_remove_entry` feature --- src/libstd/collections/hash/map.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 20a4f9b508d24..14ef8563bb064 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1379,7 +1379,6 @@ impl HashMap /// # Examples /// /// ``` - /// #![feature(hash_map_remove_entry)] /// use std::collections::HashMap; /// /// # fn main() { @@ -1389,7 +1388,7 @@ impl HashMap /// assert_eq!(map.remove(&1), None); /// # } /// ``` - #[unstable(feature = "hash_map_remove_entry", issue = "46344")] + #[stable(feature = "hash_map_remove_entry", since = "1.27.0")] pub fn remove_entry(&mut self, k: &Q) -> Option<(K, V)> where K: Borrow, Q: Hash + Eq