diff options
| author | Aaron Turon <aturon@mozilla.com> | 2016-12-14 12:27:30 -0800 |
|---|---|---|
| committer | Aaron Turon <aturon@mozilla.com> | 2016-12-15 10:56:55 -0800 |
| commit | b02ed1e1d495e25252dc49c5f0f5e1da1b24b78e (patch) | |
| tree | 9fdcd0365066bf4e233427658311f02f62bb008a /src/liballoc | |
| parent | 65b144c964987970974742526ad5985d53f19da9 (diff) | |
| download | rust-b02ed1e1d495e25252dc49c5f0f5e1da1b24b78e.tar.gz rust-b02ed1e1d495e25252dc49c5f0f5e1da1b24b78e.zip | |
Stabilize:
- `std::rc::Rc::{strong_count, weak_count}`
- `std::sync::Arc::{strong_count, weak_count}`
Deprecate:
- `std::rc::Rc::{would_unwrap, is_unique}`
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/arc.rs | 10 | ||||
| -rw-r--r-- | src/liballoc/rc.rs | 13 |
2 files changed, 7 insertions, 16 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 3a7da18c8de..1cad8f7f407 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -392,8 +392,6 @@ impl<T: ?Sized> Arc<T> { /// # Examples /// /// ``` - /// #![feature(arc_counts)] - /// /// use std::sync::Arc; /// /// let five = Arc::new(5); @@ -404,8 +402,7 @@ impl<T: ?Sized> Arc<T> { /// assert_eq!(1, Arc::weak_count(&five)); /// ``` #[inline] - #[unstable(feature = "arc_counts", reason = "not clearly useful, and racy", - issue = "28356")] + #[stable(feature = "arc_counts", since = "1.15.0")] pub fn weak_count(this: &Self) -> usize { this.inner().weak.load(SeqCst) - 1 } @@ -421,8 +418,6 @@ impl<T: ?Sized> Arc<T> { /// # Examples /// /// ``` - /// #![feature(arc_counts)] - /// /// use std::sync::Arc; /// /// let five = Arc::new(5); @@ -433,8 +428,7 @@ impl<T: ?Sized> Arc<T> { /// assert_eq!(2, Arc::strong_count(&five)); /// ``` #[inline] - #[unstable(feature = "arc_counts", reason = "not clearly useful, and racy", - issue = "28356")] + #[stable(feature = "arc_counts", since = "1.15.0")] pub fn strong_count(this: &Self) -> usize { this.inner().strong.load(SeqCst) } diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index d1e0e333b8f..8d2b1a770b2 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -363,6 +363,7 @@ impl<T> Rc<T> { #[unstable(feature = "rc_would_unwrap", reason = "just added for niche usecase", issue = "28356")] + #[rustc_deprecated(since = "1.15.0", reason = "too niche; use `strong_count` instead")] pub fn would_unwrap(this: &Self) -> bool { Rc::strong_count(&this) == 1 } @@ -482,8 +483,6 @@ impl<T: ?Sized> Rc<T> { /// # Examples /// /// ``` - /// #![feature(rc_counts)] - /// /// use std::rc::Rc; /// /// let five = Rc::new(5); @@ -492,8 +491,7 @@ impl<T: ?Sized> Rc<T> { /// assert_eq!(1, Rc::weak_count(&five)); /// ``` #[inline] - #[unstable(feature = "rc_counts", reason = "not clearly useful", - issue = "28356")] + #[stable(feature = "rc_counts", since = "1.15.0")] pub fn weak_count(this: &Self) -> usize { this.weak() - 1 } @@ -503,8 +501,6 @@ impl<T: ?Sized> Rc<T> { /// # Examples /// /// ``` - /// #![feature(rc_counts)] - /// /// use std::rc::Rc; /// /// let five = Rc::new(5); @@ -513,8 +509,7 @@ impl<T: ?Sized> Rc<T> { /// assert_eq!(2, Rc::strong_count(&five)); /// ``` #[inline] - #[unstable(feature = "rc_counts", reason = "not clearly useful", - issue = "28356")] + #[stable(feature = "rc_counts", since = "1.15.0")] pub fn strong_count(this: &Self) -> usize { this.strong() } @@ -538,6 +533,8 @@ impl<T: ?Sized> Rc<T> { #[inline] #[unstable(feature = "rc_counts", reason = "uniqueness has unclear meaning", issue = "28356")] + #[rustc_deprecated(since = "1.15.0", + reason = "too niche; use `strong_count` and `weak_count` instead")] pub fn is_unique(this: &Self) -> bool { Rc::weak_count(this) == 0 && Rc::strong_count(this) == 1 } |
