Skip to content

Commit

Permalink
Stablize arc_unwrap_or_clone
Browse files Browse the repository at this point in the history
  • Loading branch information
ranile committed Oct 19, 2023
1 parent c104861 commit 540921e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions library/alloc/src/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1748,7 +1748,6 @@ impl<T: Clone, A: Allocator + Clone> Rc<T, A> {
/// # Examples
///
/// ```
/// #![feature(arc_unwrap_or_clone)]
/// # use std::{ptr, rc::Rc};
/// let inner = String::from("test");
/// let ptr = inner.as_ptr();
Expand All @@ -1769,7 +1768,7 @@ impl<T: Clone, A: Allocator + Clone> Rc<T, A> {
/// assert!(ptr::eq(ptr, inner.as_ptr()));
/// ```
#[inline]
#[unstable(feature = "arc_unwrap_or_clone", issue = "93610")]
#[stable(feature = "arc_unwrap_or_clone", since = "CURRENT_RUSTC_VERSION")]
pub fn unwrap_or_clone(this: Self) -> T {
Rc::try_unwrap(this).unwrap_or_else(|rc| (*rc).clone())
}
Expand Down
3 changes: 1 addition & 2 deletions library/alloc/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2174,7 +2174,6 @@ impl<T: Clone, A: Allocator + Clone> Arc<T, A> {
/// # Examples
///
/// ```
/// #![feature(arc_unwrap_or_clone)]
/// # use std::{ptr, sync::Arc};
/// let inner = String::from("test");
/// let ptr = inner.as_ptr();
Expand All @@ -2195,7 +2194,7 @@ impl<T: Clone, A: Allocator + Clone> Arc<T, A> {
/// assert!(ptr::eq(ptr, inner.as_ptr()));
/// ```
#[inline]
#[unstable(feature = "arc_unwrap_or_clone", issue = "93610")]
#[stable(feature = "arc_unwrap_or_clone", since = "CURRENT_RUSTC_VERSION")]
pub fn unwrap_or_clone(this: Self) -> T {
Arc::try_unwrap(this).unwrap_or_else(|arc| (*arc).clone())
}
Expand Down

0 comments on commit 540921e

Please sign in to comment.