Skip to content

Commit 4867a21

Browse files
committed
Stabilize Vec<T>::shrink_to
1 parent 9a27044 commit 4867a21

File tree

9 files changed

+8
-16
lines changed

9 files changed

+8
-16
lines changed

library/alloc/src/collections/binary_heap.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,6 @@ impl<T> BinaryHeap<T> {
965965
/// # Examples
966966
///
967967
/// ```
968-
/// #![feature(shrink_to)]
969968
/// use std::collections::BinaryHeap;
970969
/// let mut heap: BinaryHeap<i32> = BinaryHeap::with_capacity(100);
971970
///
@@ -974,7 +973,7 @@ impl<T> BinaryHeap<T> {
974973
/// assert!(heap.capacity() >= 10);
975974
/// ```
976975
#[inline]
977-
#[unstable(feature = "shrink_to", reason = "new API", issue = "56431")]
976+
#[stable(feature = "shrink_to", since = "1.55.0")]
978977
pub fn shrink_to(&mut self, min_capacity: usize) {
979978
self.data.shrink_to(min_capacity)
980979
}

library/alloc/src/collections/vec_deque/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,6 @@ impl<T> VecDeque<T> {
766766
/// # Examples
767767
///
768768
/// ```
769-
/// #![feature(shrink_to)]
770769
/// use std::collections::VecDeque;
771770
///
772771
/// let mut buf = VecDeque::with_capacity(15);
@@ -777,7 +776,7 @@ impl<T> VecDeque<T> {
777776
/// buf.shrink_to(0);
778777
/// assert!(buf.capacity() >= 4);
779778
/// ```
780-
#[unstable(feature = "shrink_to", reason = "new API", issue = "56431")]
779+
#[stable(feature = "shrink_to", since = "1.55.0")]
781780
pub fn shrink_to(&mut self, min_capacity: usize) {
782781
let min_capacity = cmp::min(min_capacity, self.capacity());
783782
// We don't have to worry about an overflow as neither `self.len()` nor `self.capacity()`

library/alloc/src/string.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,6 @@ impl String {
10981098
/// # Examples
10991099
///
11001100
/// ```
1101-
/// #![feature(shrink_to)]
11021101
/// let mut s = String::from("foo");
11031102
///
11041103
/// s.reserve(100);
@@ -1111,7 +1110,7 @@ impl String {
11111110
/// ```
11121111
#[cfg(not(no_global_oom_handling))]
11131112
#[inline]
1114-
#[unstable(feature = "shrink_to", reason = "new API", issue = "56431")]
1113+
#[stable(feature = "shrink_to", since = "1.55.0")]
11151114
pub fn shrink_to(&mut self, min_capacity: usize) {
11161115
self.vec.shrink_to(min_capacity)
11171116
}

library/alloc/src/vec/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,6 @@ impl<T, A: Allocator> Vec<T, A> {
942942
/// # Examples
943943
///
944944
/// ```
945-
/// #![feature(shrink_to)]
946945
/// let mut vec = Vec::with_capacity(10);
947946
/// vec.extend([1, 2, 3]);
948947
/// assert_eq!(vec.capacity(), 10);
@@ -952,7 +951,7 @@ impl<T, A: Allocator> Vec<T, A> {
952951
/// assert!(vec.capacity() >= 3);
953952
/// ```
954953
#[cfg(not(no_global_oom_handling))]
955-
#[unstable(feature = "shrink_to", reason = "new API", issue = "56431")]
954+
#[stable(feature = "shrink_to", since = "1.55.0")]
956955
pub fn shrink_to(&mut self, min_capacity: usize) {
957956
if self.capacity() > min_capacity {
958957
self.buf.shrink_to_fit(cmp::max(self.len, min_capacity));

library/std/src/collections/hash/map.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,6 @@ where
665665
/// # Examples
666666
///
667667
/// ```
668-
/// #![feature(shrink_to)]
669668
/// use std::collections::HashMap;
670669
///
671670
/// let mut map: HashMap<i32, i32> = HashMap::with_capacity(100);
@@ -678,7 +677,7 @@ where
678677
/// assert!(map.capacity() >= 2);
679678
/// ```
680679
#[inline]
681-
#[unstable(feature = "shrink_to", reason = "new API", issue = "56431")]
680+
#[stable(feature = "shrink_to", since = "1.55.0")]
682681
pub fn shrink_to(&mut self, min_capacity: usize) {
683682
self.base.shrink_to(min_capacity);
684683
}

library/std/src/collections/hash/set.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,6 @@ where
466466
/// # Examples
467467
///
468468
/// ```
469-
/// #![feature(shrink_to)]
470469
/// use std::collections::HashSet;
471470
///
472471
/// let mut set = HashSet::with_capacity(100);
@@ -479,7 +478,7 @@ where
479478
/// assert!(set.capacity() >= 2);
480479
/// ```
481480
#[inline]
482-
#[unstable(feature = "shrink_to", reason = "new API", issue = "56431")]
481+
#[stable(feature = "shrink_to", since = "1.55.0")]
483482
pub fn shrink_to(&mut self, min_capacity: usize) {
484483
self.base.shrink_to(min_capacity)
485484
}

library/std/src/ffi/os_str.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ impl OsString {
319319
/// # Examples
320320
///
321321
/// ```
322-
/// #![feature(shrink_to)]
323322
/// use std::ffi::OsString;
324323
///
325324
/// let mut s = OsString::from("foo");
@@ -333,7 +332,7 @@ impl OsString {
333332
/// assert!(s.capacity() >= 3);
334333
/// ```
335334
#[inline]
336-
#[unstable(feature = "shrink_to", reason = "new API", issue = "56431")]
335+
#[stable(feature = "shrink_to", since = "1.55.0")]
337336
pub fn shrink_to(&mut self, min_capacity: usize) {
338337
self.inner.shrink_to(min_capacity)
339338
}

library/std/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,6 @@
306306
#![feature(ready_macro)]
307307
#![feature(rustc_attrs)]
308308
#![feature(rustc_private)]
309-
#![feature(shrink_to)]
310309
#![feature(slice_concat_ext)]
311310
#![feature(slice_internals)]
312311
#![feature(slice_ptr_get)]

library/std/src/path.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@ impl PathBuf {
13981398
/// Invokes [`shrink_to`] on the underlying instance of [`OsString`].
13991399
///
14001400
/// [`shrink_to`]: OsString::shrink_to
1401-
#[unstable(feature = "shrink_to", issue = "56431")]
1401+
#[stable(feature = "shrink_to", since = "1.55.0")]
14021402
#[inline]
14031403
pub fn shrink_to(&mut self, min_capacity: usize) {
14041404
self.inner.shrink_to(min_capacity)

0 commit comments

Comments
 (0)