Skip to content

Commit ac3c228

Browse files
committed
Auto merge of #50017 - tinaun:stabilize-all-the-things, r=sfackler
stabilize a bunch of minor api additions besides `ptr::NonNull::cast` (which is 4 days away from end of FCP) all of these have been finished with FCP for a few weeks now with minimal issues raised * Closes #41020 * Closes #42818 * Closes #44030 * Closes #44400 * Closes #46507 * Closes #47653 * Closes #46344 the following functions will be stabilized in 1.27: * `[T]::rsplit` * `[T]::rsplit_mut` * `[T]::swap_with_slice` * `ptr::swap_nonoverlapping` * `NonNull::cast` * `Duration::from_micros` * `Duration::from_nanos` * `Duration::subsec_millis` * `Duration::subsec_micros` * `HashMap::remove_entry`
2 parents c8fa49f + fd042ee commit ac3c228

File tree

9 files changed

+28
-59
lines changed

9 files changed

+28
-59
lines changed

src/doc/unstable-book/src/library-features/slice-rsplit.md

-10
This file was deleted.

src/liballoc/lib.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
#![feature(lang_items)]
100100
#![feature(libc)]
101101
#![feature(needs_allocator)]
102-
#![feature(nonnull_cast)]
103102
#![feature(nonzero)]
104103
#![feature(optin_builtin_traits)]
105104
#![feature(pattern)]
@@ -108,7 +107,6 @@
108107
#![feature(ptr_offset_from)]
109108
#![feature(rustc_attrs)]
110109
#![feature(slice_get_slice)]
111-
#![feature(slice_rsplit)]
112110
#![feature(specialization)]
113111
#![feature(staged_api)]
114112
#![feature(str_internals)]
@@ -124,7 +122,7 @@
124122
#![feature(inclusive_range_fields)]
125123
#![cfg_attr(stage0, feature(generic_param_attrs))]
126124

127-
#![cfg_attr(not(test), feature(fn_traits, swap_with_slice, i128))]
125+
#![cfg_attr(not(test), feature(fn_traits, i128))]
128126
#![cfg_attr(test, feature(test))]
129127

130128
// Allow testing this library

src/liballoc/slice.rs

+4-15
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub use core::slice::{Iter, IterMut};
116116
pub use core::slice::{SplitMut, ChunksMut, Split};
117117
#[stable(feature = "rust1", since = "1.0.0")]
118118
pub use core::slice::{SplitN, RSplitN, SplitNMut, RSplitNMut};
119-
#[unstable(feature = "slice_rsplit", issue = "41020")]
119+
#[stable(feature = "slice_rsplit", since = "1.27.0")]
120120
pub use core::slice::{RSplit, RSplitMut};
121121
#[stable(feature = "rust1", since = "1.0.0")]
122122
pub use core::slice::{from_raw_parts, from_raw_parts_mut};
@@ -888,7 +888,6 @@ impl<T> [T] {
888888
/// # Examples
889889
///
890890
/// ```
891-
/// #![feature(slice_rsplit)]
892891
///
893892
/// let slice = [11, 22, 33, 0, 44, 55];
894893
/// let mut iter = slice.rsplit(|num| *num == 0);
@@ -902,8 +901,6 @@ impl<T> [T] {
902901
/// slice will be the first (or last) item returned by the iterator.
903902
///
904903
/// ```
905-
/// #![feature(slice_rsplit)]
906-
///
907904
/// let v = &[0, 1, 1, 2, 3, 5, 8];
908905
/// let mut it = v.rsplit(|n| *n % 2 == 0);
909906
/// assert_eq!(it.next().unwrap(), &[]);
@@ -912,7 +909,7 @@ impl<T> [T] {
912909
/// assert_eq!(it.next().unwrap(), &[]);
913910
/// assert_eq!(it.next(), None);
914911
/// ```
915-
#[unstable(feature = "slice_rsplit", issue = "41020")]
912+
#[stable(feature = "slice_rsplit", since = "1.27.0")]
916913
#[inline]
917914
pub fn rsplit<F>(&self, pred: F) -> RSplit<T, F>
918915
where F: FnMut(&T) -> bool
@@ -927,8 +924,6 @@ impl<T> [T] {
927924
/// # Examples
928925
///
929926
/// ```
930-
/// #![feature(slice_rsplit)]
931-
///
932927
/// let mut v = [100, 400, 300, 200, 600, 500];
933928
///
934929
/// let mut count = 0;
@@ -939,7 +934,7 @@ impl<T> [T] {
939934
/// assert_eq!(v, [3, 400, 300, 2, 600, 1]);
940935
/// ```
941936
///
942-
#[unstable(feature = "slice_rsplit", issue = "41020")]
937+
#[stable(feature = "slice_rsplit", since = "1.27.0")]
943938
#[inline]
944939
pub fn rsplit_mut<F>(&mut self, pred: F) -> RSplitMut<T, F>
945940
where F: FnMut(&T) -> bool
@@ -1707,8 +1702,6 @@ impl<T> [T] {
17071702
/// Swapping two elements across slices:
17081703
///
17091704
/// ```
1710-
/// #![feature(swap_with_slice)]
1711-
///
17121705
/// let mut slice1 = [0, 0];
17131706
/// let mut slice2 = [1, 2, 3, 4];
17141707
///
@@ -1724,8 +1717,6 @@ impl<T> [T] {
17241717
/// a compile failure:
17251718
///
17261719
/// ```compile_fail
1727-
/// #![feature(swap_with_slice)]
1728-
///
17291720
/// let mut slice = [1, 2, 3, 4, 5];
17301721
/// slice[..2].swap_with_slice(&mut slice[3..]); // compile fail!
17311722
/// ```
@@ -1734,8 +1725,6 @@ impl<T> [T] {
17341725
/// mutable sub-slices from a slice:
17351726
///
17361727
/// ```
1737-
/// #![feature(swap_with_slice)]
1738-
///
17391728
/// let mut slice = [1, 2, 3, 4, 5];
17401729
///
17411730
/// {
@@ -1747,7 +1736,7 @@ impl<T> [T] {
17471736
/// ```
17481737
///
17491738
/// [`split_at_mut`]: #method.split_at_mut
1750-
#[unstable(feature = "swap_with_slice", issue = "44030")]
1739+
#[stable(feature = "swap_with_slice", since = "1.27.0")]
17511740
pub fn swap_with_slice(&mut self, other: &mut [T]) {
17521741
core_slice::SliceExt::swap_with_slice(self, other)
17531742
}

src/libcore/ptr.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ pub unsafe fn swap<T>(x: *mut T, y: *mut T) {
166166
/// Basic usage:
167167
///
168168
/// ```
169-
/// #![feature(swap_nonoverlapping)]
170-
///
171169
/// use std::ptr;
172170
///
173171
/// let mut x = [1, 2, 3, 4];
@@ -181,7 +179,7 @@ pub unsafe fn swap<T>(x: *mut T, y: *mut T) {
181179
/// assert_eq!(y, [1, 2, 9]);
182180
/// ```
183181
#[inline]
184-
#[unstable(feature = "swap_nonoverlapping", issue = "42818")]
182+
#[stable(feature = "swap_nonoverlapping", since = "1.27.0")]
185183
pub unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) {
186184
let x = x as *mut u8;
187185
let y = y as *mut u8;
@@ -2744,7 +2742,7 @@ impl<T: ?Sized> NonNull<T> {
27442742
}
27452743

27462744
/// Cast to a pointer of another type
2747-
#[unstable(feature = "nonnull_cast", issue = "47653")]
2745+
#[stable(feature = "nonnull_cast", since = "1.27.0")]
27482746
pub fn cast<U>(self) -> NonNull<U> {
27492747
unsafe {
27502748
NonNull::new_unchecked(self.as_ptr() as *mut U)

src/libcore/slice/mod.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub trait SliceExt {
8686
fn split<P>(&self, pred: P) -> Split<Self::Item, P>
8787
where P: FnMut(&Self::Item) -> bool;
8888

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

@@ -169,7 +169,7 @@ pub trait SliceExt {
169169
fn split_mut<P>(&mut self, pred: P) -> SplitMut<Self::Item, P>
170170
where P: FnMut(&Self::Item) -> bool;
171171

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

@@ -223,7 +223,7 @@ pub trait SliceExt {
223223
#[stable(feature = "copy_from_slice", since = "1.9.0")]
224224
fn copy_from_slice(&mut self, src: &[Self::Item]) where Self::Item: Copy;
225225

226-
#[unstable(feature = "swap_with_slice", issue = "44030")]
226+
#[stable(feature = "swap_with_slice", since = "1.27.0")]
227227
fn swap_with_slice(&mut self, src: &mut [Self::Item]);
228228

229229
#[stable(feature = "sort_unstable", since = "1.20.0")]
@@ -1840,13 +1840,13 @@ impl<'a, T, P> FusedIterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool {
18401840
///
18411841
/// [`rsplit`]: ../../std/primitive.slice.html#method.rsplit
18421842
/// [slices]: ../../std/primitive.slice.html
1843-
#[unstable(feature = "slice_rsplit", issue = "41020")]
1843+
#[stable(feature = "slice_rsplit", since = "1.27.0")]
18441844
#[derive(Clone)] // Is this correct, or does it incorrectly require `T: Clone`?
18451845
pub struct RSplit<'a, T:'a, P> where P: FnMut(&T) -> bool {
18461846
inner: Split<'a, T, P>
18471847
}
18481848

1849-
#[unstable(feature = "slice_rsplit", issue = "41020")]
1849+
#[stable(feature = "slice_rsplit", since = "1.27.0")]
18501850
impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for RSplit<'a, T, P> where P: FnMut(&T) -> bool {
18511851
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
18521852
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(&
18561856
}
18571857
}
18581858

1859-
#[unstable(feature = "slice_rsplit", issue = "41020")]
1859+
#[stable(feature = "slice_rsplit", since = "1.27.0")]
18601860
impl<'a, T, P> Iterator for RSplit<'a, T, P> where P: FnMut(&T) -> bool {
18611861
type Item = &'a [T];
18621862

@@ -1871,23 +1871,23 @@ impl<'a, T, P> Iterator for RSplit<'a, T, P> where P: FnMut(&T) -> bool {
18711871
}
18721872
}
18731873

1874-
#[unstable(feature = "slice_rsplit", issue = "41020")]
1874+
#[stable(feature = "slice_rsplit", since = "1.27.0")]
18751875
impl<'a, T, P> DoubleEndedIterator for RSplit<'a, T, P> where P: FnMut(&T) -> bool {
18761876
#[inline]
18771877
fn next_back(&mut self) -> Option<&'a [T]> {
18781878
self.inner.next()
18791879
}
18801880
}
18811881

1882-
#[unstable(feature = "slice_rsplit", issue = "41020")]
1882+
#[stable(feature = "slice_rsplit", since = "1.27.0")]
18831883
impl<'a, T, P> SplitIter for RSplit<'a, T, P> where P: FnMut(&T) -> bool {
18841884
#[inline]
18851885
fn finish(&mut self) -> Option<&'a [T]> {
18861886
self.inner.finish()
18871887
}
18881888
}
18891889

1890-
#[unstable(feature = "slice_rsplit", issue = "41020")]
1890+
#[stable(feature = "slice_rsplit", since = "1.27.0")]
18911891
impl<'a, T, P> FusedIterator for RSplit<'a, T, P> where P: FnMut(&T) -> bool {}
18921892

18931893
/// 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 {}
18971897
///
18981898
/// [`rsplit_mut`]: ../../std/primitive.slice.html#method.rsplit_mut
18991899
/// [slices]: ../../std/primitive.slice.html
1900-
#[unstable(feature = "slice_rsplit", issue = "41020")]
1900+
#[stable(feature = "slice_rsplit", since = "1.27.0")]
19011901
pub struct RSplitMut<'a, T:'a, P> where P: FnMut(&T) -> bool {
19021902
inner: SplitMut<'a, T, P>
19031903
}
19041904

1905-
#[unstable(feature = "slice_rsplit", issue = "41020")]
1905+
#[stable(feature = "slice_rsplit", since = "1.27.0")]
19061906
impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for RSplitMut<'a, T, P> where P: FnMut(&T) -> bool {
19071907
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
19081908
f.debug_struct("RSplitMut")
@@ -1912,15 +1912,15 @@ impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for RSplitMut<'a, T, P> where P: FnMu
19121912
}
19131913
}
19141914

1915-
#[unstable(feature = "slice_rsplit", issue = "41020")]
1915+
#[stable(feature = "slice_rsplit", since = "1.27.0")]
19161916
impl<'a, T, P> SplitIter for RSplitMut<'a, T, P> where P: FnMut(&T) -> bool {
19171917
#[inline]
19181918
fn finish(&mut self) -> Option<&'a mut [T]> {
19191919
self.inner.finish()
19201920
}
19211921
}
19221922

1923-
#[unstable(feature = "slice_rsplit", issue = "41020")]
1923+
#[stable(feature = "slice_rsplit", since = "1.27.0")]
19241924
impl<'a, T, P> Iterator for RSplitMut<'a, T, P> where P: FnMut(&T) -> bool {
19251925
type Item = &'a mut [T];
19261926

@@ -1935,7 +1935,7 @@ impl<'a, T, P> Iterator for RSplitMut<'a, T, P> where P: FnMut(&T) -> bool {
19351935
}
19361936
}
19371937

1938-
#[unstable(feature = "slice_rsplit", issue = "41020")]
1938+
#[stable(feature = "slice_rsplit", since = "1.27.0")]
19391939
impl<'a, T, P> DoubleEndedIterator for RSplitMut<'a, T, P> where
19401940
P: FnMut(&T) -> bool,
19411941
{
@@ -1945,7 +1945,7 @@ impl<'a, T, P> DoubleEndedIterator for RSplitMut<'a, T, P> where
19451945
}
19461946
}
19471947

1948-
#[unstable(feature = "slice_rsplit", issue = "41020")]
1948+
#[stable(feature = "slice_rsplit", since = "1.27.0")]
19491949
impl<'a, T, P> FusedIterator for RSplitMut<'a, T, P> where P: FnMut(&T) -> bool {}
19501950

19511951
/// An private iterator over subslices separated by elements that

src/libcore/time.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,14 @@ impl Duration {
137137
/// # Examples
138138
///
139139
/// ```
140-
/// #![feature(duration_from_micros)]
141140
/// use std::time::Duration;
142141
///
143142
/// let duration = Duration::from_micros(1_000_002);
144143
///
145144
/// assert_eq!(1, duration.as_secs());
146145
/// assert_eq!(2000, duration.subsec_nanos());
147146
/// ```
148-
#[unstable(feature = "duration_from_micros", issue = "44400")]
147+
#[stable(feature = "duration_from_micros", since = "1.27.0")]
149148
#[inline]
150149
pub const fn from_micros(micros: u64) -> Duration {
151150
Duration {
@@ -159,15 +158,14 @@ impl Duration {
159158
/// # Examples
160159
///
161160
/// ```
162-
/// #![feature(duration_extras)]
163161
/// use std::time::Duration;
164162
///
165163
/// let duration = Duration::from_nanos(1_000_000_123);
166164
///
167165
/// assert_eq!(1, duration.as_secs());
168166
/// assert_eq!(123, duration.subsec_nanos());
169167
/// ```
170-
#[unstable(feature = "duration_extras", issue = "46507")]
168+
#[stable(feature = "duration_extras", since = "1.27.0")]
171169
#[inline]
172170
pub const fn from_nanos(nanos: u64) -> Duration {
173171
Duration {
@@ -217,14 +215,13 @@ impl Duration {
217215
/// # Examples
218216
///
219217
/// ```
220-
/// #![feature(duration_extras)]
221218
/// use std::time::Duration;
222219
///
223220
/// let duration = Duration::from_millis(5432);
224221
/// assert_eq!(duration.as_secs(), 5);
225222
/// assert_eq!(duration.subsec_millis(), 432);
226223
/// ```
227-
#[unstable(feature = "duration_extras", issue = "46507")]
224+
#[stable(feature = "duration_extras", since = "1.27.0")]
228225
#[inline]
229226
pub fn subsec_millis(&self) -> u32 { self.nanos / NANOS_PER_MILLI }
230227

@@ -237,14 +234,13 @@ impl Duration {
237234
/// # Examples
238235
///
239236
/// ```
240-
/// #![feature(duration_extras, duration_from_micros)]
241237
/// use std::time::Duration;
242238
///
243239
/// let duration = Duration::from_micros(1_234_567);
244240
/// assert_eq!(duration.as_secs(), 1);
245241
/// assert_eq!(duration.subsec_micros(), 234_567);
246242
/// ```
247-
#[unstable(feature = "duration_extras", issue = "46507")]
243+
#[stable(feature = "duration_extras", since = "1.27.0")]
248244
#[inline]
249245
pub fn subsec_micros(&self) -> u32 { self.nanos / NANOS_PER_MICRO }
250246

src/libstd/collections/hash/map.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,6 @@ impl<K, V, S> HashMap<K, V, S>
13791379
/// # Examples
13801380
///
13811381
/// ```
1382-
/// #![feature(hash_map_remove_entry)]
13831382
/// use std::collections::HashMap;
13841383
///
13851384
/// # fn main() {
@@ -1389,7 +1388,7 @@ impl<K, V, S> HashMap<K, V, S>
13891388
/// assert_eq!(map.remove(&1), None);
13901389
/// # }
13911390
/// ```
1392-
#[unstable(feature = "hash_map_remove_entry", issue = "46344")]
1391+
#[stable(feature = "hash_map_remove_entry", since = "1.27.0")]
13931392
pub fn remove_entry<Q: ?Sized>(&mut self, k: &Q) -> Option<(K, V)>
13941393
where K: Borrow<Q>,
13951394
Q: Hash + Eq

src/libstd/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@
275275
#![feature(macro_reexport)]
276276
#![feature(macro_vis_matcher)]
277277
#![feature(needs_panic_runtime)]
278-
#![feature(nonnull_cast)]
279278
#![feature(exhaustive_patterns)]
280279
#![feature(nonzero)]
281280
#![feature(num_bits_bytes)]

src/test/run-pass/realloc-16687.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// Ideally this would be revised to use no_std, but for now it serves
1414
// well enough to reproduce (and illustrate) the bug from #16687.
1515

16-
#![feature(heap_api, allocator_api, nonnull_cast)]
16+
#![feature(heap_api, allocator_api)]
1717

1818
use std::alloc::{Global, Alloc, Layout};
1919
use std::ptr::{self, NonNull};

0 commit comments

Comments
 (0)