about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/rc.rs33
1 files changed, 2 insertions, 31 deletions
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs
index 8d2b1a770b2..86f8c746646 100644
--- a/src/liballoc/rc.rs
+++ b/src/liballoc/rc.rs
@@ -320,7 +320,7 @@ impl<T> Rc<T> {
     #[inline]
     #[stable(feature = "rc_unique", since = "1.4.0")]
     pub fn try_unwrap(this: Self) -> Result<T, Self> {
-        if Rc::would_unwrap(&this) {
+        if Rc::strong_count(&this) == 1 {
             unsafe {
                 let val = ptr::read(&*this); // copy the contained object
 
@@ -343,23 +343,6 @@ impl<T> Rc<T> {
     ///
     /// [try_unwrap]: struct.Rc.html#method.try_unwrap
     /// [`Ok`]: ../../std/result/enum.Result.html#variant.Ok
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// #![feature(rc_would_unwrap)]
-    ///
-    /// use std::rc::Rc;
-    ///
-    /// let x = Rc::new(3);
-    /// assert!(Rc::would_unwrap(&x));
-    /// assert_eq!(Rc::try_unwrap(x), Ok(3));
-    ///
-    /// let x = Rc::new(4);
-    /// let _y = x.clone();
-    /// assert!(!Rc::would_unwrap(&x));
-    /// assert_eq!(*Rc::try_unwrap(x).unwrap_err(), 4);
-    /// ```
     #[unstable(feature = "rc_would_unwrap",
                reason = "just added for niche usecase",
                issue = "28356")]
@@ -518,20 +501,8 @@ impl<T: ?Sized> Rc<T> {
     /// this inner value.
     ///
     /// [weak]: struct.Weak.html
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// #![feature(rc_counts)]
-    ///
-    /// use std::rc::Rc;
-    ///
-    /// let five = Rc::new(5);
-    ///
-    /// assert!(Rc::is_unique(&five));
-    /// ```
     #[inline]
-    #[unstable(feature = "rc_counts", reason = "uniqueness has unclear meaning",
+    #[unstable(feature = "is_unique", reason = "uniqueness has unclear meaning",
                issue = "28356")]
     #[rustc_deprecated(since = "1.15.0",
                        reason = "too niche; use `strong_count` and `weak_count` instead")]