Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions library/alloc/src/collections/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,6 @@ impl<T, A: Allocator> LinkedList<T, A> {
/// # Examples
///
/// ```
/// #![feature(push_mut)]
/// use std::collections::LinkedList;
///
/// let mut dl = LinkedList::from([1, 2, 3]);
Expand All @@ -863,7 +862,7 @@ impl<T, A: Allocator> LinkedList<T, A> {
/// *ptr += 4;
/// assert_eq!(dl.front().unwrap(), &6);
/// ```
#[unstable(feature = "push_mut", issue = "135974")]
#[stable(feature = "push_mut", since = "CURRENT_RUSTC_VERSION")]
#[must_use = "if you don't need a reference to the value, use `LinkedList::push_front` instead"]
pub fn push_front_mut(&mut self, elt: T) -> &mut T {
let mut node =
Expand Down Expand Up @@ -926,7 +925,6 @@ impl<T, A: Allocator> LinkedList<T, A> {
/// # Examples
///
/// ```
/// #![feature(push_mut)]
/// use std::collections::LinkedList;
///
/// let mut dl = LinkedList::from([1, 2, 3]);
Expand All @@ -935,7 +933,7 @@ impl<T, A: Allocator> LinkedList<T, A> {
/// *ptr += 4;
/// assert_eq!(dl.back().unwrap(), &6);
/// ```
#[unstable(feature = "push_mut", issue = "135974")]
#[stable(feature = "push_mut", since = "CURRENT_RUSTC_VERSION")]
#[must_use = "if you don't need a reference to the value, use `LinkedList::push_back` instead"]
pub fn push_back_mut(&mut self, elt: T) -> &mut T {
let mut node =
Expand Down
9 changes: 3 additions & 6 deletions library/alloc/src/collections/vec_deque/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2168,15 +2168,14 @@ impl<T, A: Allocator> VecDeque<T, A> {
/// # Examples
///
/// ```
/// #![feature(push_mut)]
/// use std::collections::VecDeque;
///
/// let mut d = VecDeque::from([1, 2, 3]);
/// let x = d.push_front_mut(8);
/// *x -= 1;
/// assert_eq!(d.front(), Some(&7));
/// ```
#[unstable(feature = "push_mut", issue = "135974")]
#[stable(feature = "push_mut", since = "CURRENT_RUSTC_VERSION")]
#[must_use = "if you don't need a reference to the value, use `VecDeque::push_front` instead"]
pub fn push_front_mut(&mut self, value: T) -> &mut T {
if self.is_full() {
Expand Down Expand Up @@ -2212,15 +2211,14 @@ impl<T, A: Allocator> VecDeque<T, A> {
/// # Examples
///
/// ```
/// #![feature(push_mut)]
/// use std::collections::VecDeque;
///
/// let mut d = VecDeque::from([1, 2, 3]);
/// let x = d.push_back_mut(9);
/// *x += 1;
/// assert_eq!(d.back(), Some(&10));
/// ```
#[unstable(feature = "push_mut", issue = "135974")]
#[stable(feature = "push_mut", since = "CURRENT_RUSTC_VERSION")]
#[must_use = "if you don't need a reference to the value, use `VecDeque::push_back` instead"]
pub fn push_back_mut(&mut self, value: T) -> &mut T {
if self.is_full() {
Expand Down Expand Up @@ -2419,7 +2417,6 @@ impl<T, A: Allocator> VecDeque<T, A> {
/// # Examples
///
/// ```
/// #![feature(push_mut)]
/// use std::collections::VecDeque;
///
/// let mut vec_deque = VecDeque::from([1, 2, 3]);
Expand All @@ -2428,7 +2425,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
/// *x += 7;
/// assert_eq!(vec_deque, &[1, 12, 2, 3]);
/// ```
#[unstable(feature = "push_mut", issue = "135974")]
#[stable(feature = "push_mut", since = "CURRENT_RUSTC_VERSION")]
#[must_use = "if you don't need a reference to the value, use `VecDeque::insert` instead"]
pub fn insert_mut(&mut self, index: usize, value: T) -> &mut T {
assert!(index <= self.len(), "index out of bounds");
Expand Down
9 changes: 2 additions & 7 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1003,9 +1003,6 @@ const impl<T, A: [const] Allocator + [const] Destruct> Vec<T, A> {
/// # Examples
///
/// ```
/// #![feature(push_mut)]
///
///
/// let mut vec = vec![1, 2];
/// let last = vec.push_mut(3);
/// assert_eq!(*last, 3);
Expand All @@ -1023,7 +1020,7 @@ const impl<T, A: [const] Allocator + [const] Destruct> Vec<T, A> {
/// vector's elements to a larger allocation. This expensive operation is
/// offset by the *capacity* *O*(1) insertions it allows.
#[inline]
#[unstable(feature = "push_mut", issue = "135974")]
#[stable(feature = "push_mut", since = "CURRENT_RUSTC_VERSION")]
#[must_use = "if you don't need a reference to the value, use `Vec::push` instead"]
pub fn push_mut(&mut self, value: T) -> &mut T {
// Inform codegen that the length does not change across grow_one().
Expand Down Expand Up @@ -2196,7 +2193,6 @@ impl<T, A: Allocator> Vec<T, A> {
/// # Examples
///
/// ```
/// #![feature(push_mut)]
/// let mut vec = vec![1, 3, 5, 9];
/// let x = vec.insert_mut(3, 6);
/// *x += 1;
Expand All @@ -2210,7 +2206,7 @@ impl<T, A: Allocator> Vec<T, A> {
/// the insertion index is 0.
#[cfg(not(no_global_oom_handling))]
#[inline]
#[unstable(feature = "push_mut", issue = "135974")]
#[stable(feature = "push_mut", since = "CURRENT_RUSTC_VERSION")]
#[track_caller]
#[must_use = "if you don't need a reference to the value, use `Vec::insert` instead"]
pub fn insert_mut(&mut self, index: usize, element: T) -> &mut T {
Expand Down Expand Up @@ -2689,7 +2685,6 @@ impl<T, A: Allocator> Vec<T, A> {
/// Takes *O*(1) time.
#[inline]
#[unstable(feature = "vec_push_within_capacity", issue = "100486")]
// #[unstable(feature = "push_mut", issue = "135974")]
pub fn push_within_capacity(&mut self, value: T) -> Result<&mut T, T> {
if self.len == self.buf.capacity() {
return Err(value);
Expand Down
Loading