Stabilize feature(push_mut)
This commit is contained in:
parent
a234ae6b65
commit
890e50de69
3 changed files with 7 additions and 17 deletions
|
|
@ -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]);
|
||||
|
|
@ -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 =
|
||||
|
|
@ -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]);
|
||||
|
|
@ -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 =
|
||||
|
|
|
|||
|
|
@ -2168,7 +2168,6 @@ impl<T, A: Allocator> VecDeque<T, A> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(push_mut)]
|
||||
/// use std::collections::VecDeque;
|
||||
///
|
||||
/// let mut d = VecDeque::from([1, 2, 3]);
|
||||
|
|
@ -2176,7 +2175,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
|
|||
/// *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() {
|
||||
|
|
@ -2212,7 +2211,6 @@ impl<T, A: Allocator> VecDeque<T, A> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(push_mut)]
|
||||
/// use std::collections::VecDeque;
|
||||
///
|
||||
/// let mut d = VecDeque::from([1, 2, 3]);
|
||||
|
|
@ -2220,7 +2218,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
|
|||
/// *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() {
|
||||
|
|
@ -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]);
|
||||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
@ -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().
|
||||
|
|
@ -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;
|
||||
|
|
@ -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 {
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue