diff options
| author | Aaron Turon <aturon@mozilla.com> | 2016-12-14 13:02:00 -0800 |
|---|---|---|
| committer | Aaron Turon <aturon@mozilla.com> | 2016-12-16 19:42:17 -0800 |
| commit | 9a5cef4de51c1c90fb2d05b0c7e6feb9cf0224d6 (patch) | |
| tree | dfc7eb130baf656785761739b6808efdec694254 /src/liballoc | |
| parent | fce6af2a6759991b8f31b6dcbee315ccacb2339d (diff) | |
| download | rust-9a5cef4de51c1c90fb2d05b0c7e6feb9cf0224d6.tar.gz rust-9a5cef4de51c1c90fb2d05b0c7e6feb9cf0224d6.zip | |
Address fallout
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/rc.rs | 33 |
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")] |
