Rollup merge of #95392 - Xuanwo:stablize_try_reserve_2, r=dtolnay

std: Stabilize feature try_reserve_2

This PR intends to stabilize feature `try_reserve_2`, closes https://github.com/rust-lang/rust/issues/91789

This PR will also replace the previous PR: https://github.com/rust-lang/rust/pull/95139
This commit is contained in:
Dylan DPC 2022-06-17 12:21:46 +02:00 committed by GitHub
commit b516806774
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 10 deletions

View File

@ -978,7 +978,6 @@ impl<T> BinaryHeap<T> {
/// # Examples
///
/// ```
/// #![feature(try_reserve_2)]
/// use std::collections::BinaryHeap;
/// use std::collections::TryReserveError;
///
@ -995,7 +994,7 @@ impl<T> BinaryHeap<T> {
/// }
/// # find_max_slow(&[1, 2, 3]).expect("why is the test harness OOMing on 12 bytes?");
/// ```
#[unstable(feature = "try_reserve_2", issue = "91789")]
#[stable(feature = "try_reserve_2", since = "1.63.0")]
pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveError> {
self.data.try_reserve_exact(additional)
}
@ -1014,7 +1013,6 @@ impl<T> BinaryHeap<T> {
/// # Examples
///
/// ```
/// #![feature(try_reserve_2)]
/// use std::collections::BinaryHeap;
/// use std::collections::TryReserveError;
///
@ -1031,7 +1029,7 @@ impl<T> BinaryHeap<T> {
/// }
/// # find_max_slow(&[1, 2, 3]).expect("why is the test harness OOMing on 12 bytes?");
/// ```
#[unstable(feature = "try_reserve_2", issue = "91789")]
#[stable(feature = "try_reserve_2", since = "1.63.0")]
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> {
self.data.try_reserve(additional)
}

View File

@ -300,7 +300,6 @@ impl OsString {
/// # Examples
///
/// ```
/// #![feature(try_reserve_2)]
/// use std::ffi::{OsStr, OsString};
/// use std::collections::TryReserveError;
///
@ -317,7 +316,7 @@ impl OsString {
/// }
/// # process_data("123").expect("why is the test harness OOMing on 3 bytes?");
/// ```
#[unstable(feature = "try_reserve_2", issue = "91789")]
#[stable(feature = "try_reserve_2", since = "1.63.0")]
#[inline]
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> {
self.inner.try_reserve(additional)
@ -372,7 +371,6 @@ impl OsString {
/// # Examples
///
/// ```
/// #![feature(try_reserve_2)]
/// use std::ffi::{OsStr, OsString};
/// use std::collections::TryReserveError;
///
@ -389,7 +387,7 @@ impl OsString {
/// }
/// # process_data("123").expect("why is the test harness OOMing on 3 bytes?");
/// ```
#[unstable(feature = "try_reserve_2", issue = "91789")]
#[stable(feature = "try_reserve_2", since = "1.63.0")]
#[inline]
pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveError> {
self.inner.try_reserve_exact(additional)

View File

@ -1520,7 +1520,7 @@ impl PathBuf {
/// Invokes [`try_reserve`] on the underlying instance of [`OsString`].
///
/// [`try_reserve`]: OsString::try_reserve
#[unstable(feature = "try_reserve_2", issue = "91789")]
#[stable(feature = "try_reserve_2", since = "1.63.0")]
#[inline]
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> {
self.inner.try_reserve(additional)
@ -1538,7 +1538,7 @@ impl PathBuf {
/// Invokes [`try_reserve_exact`] on the underlying instance of [`OsString`].
///
/// [`try_reserve_exact`]: OsString::try_reserve_exact
#[unstable(feature = "try_reserve_2", issue = "91789")]
#[stable(feature = "try_reserve_2", since = "1.63.0")]
#[inline]
pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveError> {
self.inner.try_reserve_exact(additional)