Skip to content

Commit 70e5959

Browse files
authored
Rollup merge of #151785 - zachs18:stabilize-push_mut, r=jhpratt
Stabilize feature(push_mut) Stabilizes `feature(push_mut)`, consisting of `Vec::push_mut`, `Vec::insert_mut`, `VecDeque::push_front_mut`, `VecDeque::push_back_mut`, `VecDeque::insert_mut`, `LinkedList::push_front_mut`, and `LinkedList::push_back_mut`. Tracking issue: #135974 FCP completed: #135974 (comment) Release notes: #151252
2 parents 3830f76 + 890e50d commit 70e5959

3 files changed

Lines changed: 7 additions & 17 deletions

File tree

library/alloc/src/collections/linked_list.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,6 @@ impl<T, A: Allocator> LinkedList<T, A> {
854854
/// # Examples
855855
///
856856
/// ```
857-
/// #![feature(push_mut)]
858857
/// use std::collections::LinkedList;
859858
///
860859
/// let mut dl = LinkedList::from([1, 2, 3]);
@@ -863,7 +862,7 @@ impl<T, A: Allocator> LinkedList<T, A> {
863862
/// *ptr += 4;
864863
/// assert_eq!(dl.front().unwrap(), &6);
865864
/// ```
866-
#[unstable(feature = "push_mut", issue = "135974")]
865+
#[stable(feature = "push_mut", since = "CURRENT_RUSTC_VERSION")]
867866
#[must_use = "if you don't need a reference to the value, use `LinkedList::push_front` instead"]
868867
pub fn push_front_mut(&mut self, elt: T) -> &mut T {
869868
let mut node =
@@ -926,7 +925,6 @@ impl<T, A: Allocator> LinkedList<T, A> {
926925
/// # Examples
927926
///
928927
/// ```
929-
/// #![feature(push_mut)]
930928
/// use std::collections::LinkedList;
931929
///
932930
/// let mut dl = LinkedList::from([1, 2, 3]);
@@ -935,7 +933,7 @@ impl<T, A: Allocator> LinkedList<T, A> {
935933
/// *ptr += 4;
936934
/// assert_eq!(dl.back().unwrap(), &6);
937935
/// ```
938-
#[unstable(feature = "push_mut", issue = "135974")]
936+
#[stable(feature = "push_mut", since = "CURRENT_RUSTC_VERSION")]
939937
#[must_use = "if you don't need a reference to the value, use `LinkedList::push_back` instead"]
940938
pub fn push_back_mut(&mut self, elt: T) -> &mut T {
941939
let mut node =

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2168,15 +2168,14 @@ impl<T, A: Allocator> VecDeque<T, A> {
21682168
/// # Examples
21692169
///
21702170
/// ```
2171-
/// #![feature(push_mut)]
21722171
/// use std::collections::VecDeque;
21732172
///
21742173
/// let mut d = VecDeque::from([1, 2, 3]);
21752174
/// let x = d.push_front_mut(8);
21762175
/// *x -= 1;
21772176
/// assert_eq!(d.front(), Some(&7));
21782177
/// ```
2179-
#[unstable(feature = "push_mut", issue = "135974")]
2178+
#[stable(feature = "push_mut", since = "CURRENT_RUSTC_VERSION")]
21802179
#[must_use = "if you don't need a reference to the value, use `VecDeque::push_front` instead"]
21812180
pub fn push_front_mut(&mut self, value: T) -> &mut T {
21822181
if self.is_full() {
@@ -2212,15 +2211,14 @@ impl<T, A: Allocator> VecDeque<T, A> {
22122211
/// # Examples
22132212
///
22142213
/// ```
2215-
/// #![feature(push_mut)]
22162214
/// use std::collections::VecDeque;
22172215
///
22182216
/// let mut d = VecDeque::from([1, 2, 3]);
22192217
/// let x = d.push_back_mut(9);
22202218
/// *x += 1;
22212219
/// assert_eq!(d.back(), Some(&10));
22222220
/// ```
2223-
#[unstable(feature = "push_mut", issue = "135974")]
2221+
#[stable(feature = "push_mut", since = "CURRENT_RUSTC_VERSION")]
22242222
#[must_use = "if you don't need a reference to the value, use `VecDeque::push_back` instead"]
22252223
pub fn push_back_mut(&mut self, value: T) -> &mut T {
22262224
if self.is_full() {
@@ -2419,7 +2417,6 @@ impl<T, A: Allocator> VecDeque<T, A> {
24192417
/// # Examples
24202418
///
24212419
/// ```
2422-
/// #![feature(push_mut)]
24232420
/// use std::collections::VecDeque;
24242421
///
24252422
/// let mut vec_deque = VecDeque::from([1, 2, 3]);
@@ -2428,7 +2425,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
24282425
/// *x += 7;
24292426
/// assert_eq!(vec_deque, &[1, 12, 2, 3]);
24302427
/// ```
2431-
#[unstable(feature = "push_mut", issue = "135974")]
2428+
#[stable(feature = "push_mut", since = "CURRENT_RUSTC_VERSION")]
24322429
#[must_use = "if you don't need a reference to the value, use `VecDeque::insert` instead"]
24332430
pub fn insert_mut(&mut self, index: usize, value: T) -> &mut T {
24342431
assert!(index <= self.len(), "index out of bounds");

library/alloc/src/vec/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,9 +1003,6 @@ const impl<T, A: [const] Allocator + [const] Destruct> Vec<T, A> {
10031003
/// # Examples
10041004
///
10051005
/// ```
1006-
/// #![feature(push_mut)]
1007-
///
1008-
///
10091006
/// let mut vec = vec![1, 2];
10101007
/// let last = vec.push_mut(3);
10111008
/// assert_eq!(*last, 3);
@@ -1023,7 +1020,7 @@ const impl<T, A: [const] Allocator + [const] Destruct> Vec<T, A> {
10231020
/// vector's elements to a larger allocation. This expensive operation is
10241021
/// offset by the *capacity* *O*(1) insertions it allows.
10251022
#[inline]
1026-
#[unstable(feature = "push_mut", issue = "135974")]
1023+
#[stable(feature = "push_mut", since = "CURRENT_RUSTC_VERSION")]
10271024
#[must_use = "if you don't need a reference to the value, use `Vec::push` instead"]
10281025
pub fn push_mut(&mut self, value: T) -> &mut T {
10291026
// Inform codegen that the length does not change across grow_one().
@@ -2196,7 +2193,6 @@ impl<T, A: Allocator> Vec<T, A> {
21962193
/// # Examples
21972194
///
21982195
/// ```
2199-
/// #![feature(push_mut)]
22002196
/// let mut vec = vec![1, 3, 5, 9];
22012197
/// let x = vec.insert_mut(3, 6);
22022198
/// *x += 1;
@@ -2210,7 +2206,7 @@ impl<T, A: Allocator> Vec<T, A> {
22102206
/// the insertion index is 0.
22112207
#[cfg(not(no_global_oom_handling))]
22122208
#[inline]
2213-
#[unstable(feature = "push_mut", issue = "135974")]
2209+
#[stable(feature = "push_mut", since = "CURRENT_RUSTC_VERSION")]
22142210
#[track_caller]
22152211
#[must_use = "if you don't need a reference to the value, use `Vec::insert` instead"]
22162212
pub fn insert_mut(&mut self, index: usize, element: T) -> &mut T {
@@ -2689,7 +2685,6 @@ impl<T, A: Allocator> Vec<T, A> {
26892685
/// Takes *O*(1) time.
26902686
#[inline]
26912687
#[unstable(feature = "vec_push_within_capacity", issue = "100486")]
2692-
// #[unstable(feature = "push_mut", issue = "135974")]
26932688
pub fn push_within_capacity(&mut self, value: T) -> Result<&mut T, T> {
26942689
if self.len == self.buf.capacity() {
26952690
return Err(value);

0 commit comments

Comments
 (0)