From cf8bfde9d313f27dc72ba3a7d15618f6bbd93e9d Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Fri, 18 Jul 2014 16:02:14 -0700 Subject: [PATCH] alloc: Stabilize rc module. Weak pointers experimental. Most everything else stable. --- src/liballoc/rc.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index d97bce39c2de9..8d4e788bc8035 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -148,6 +148,8 @@ fn main() { */ +#![stable] + use core::mem::transmute; use core::cell::Cell; use core::clone::Clone; @@ -171,6 +173,7 @@ struct RcBox { /// Immutable reference counted pointer type #[unsafe_no_drop_flag] +#[stable] pub struct Rc { // FIXME #12808: strange names to try to avoid interfering with // field accesses of the contained type via Deref @@ -179,6 +182,7 @@ pub struct Rc { _noshare: marker::NoShare } +#[stable] impl Rc { /// Construct a new reference-counted box pub fn new(value: T) -> Rc { @@ -203,6 +207,7 @@ impl Rc { impl Rc { /// Downgrade the reference-counted pointer to a weak reference + #[experimental = "Weak pointers may not belong in this module."] pub fn downgrade(&self) -> Weak { self.inc_weak(); Weak { @@ -238,6 +243,7 @@ impl Rc { } } +#[experimental = "Deref is experimental."] impl Deref for Rc { /// Borrow the value contained in the reference-counted box #[inline(always)] @@ -247,6 +253,7 @@ impl Deref for Rc { } #[unsafe_destructor] +#[experimental = "Drop is experimental."] impl Drop for Rc { fn drop(&mut self) { unsafe { @@ -269,7 +276,7 @@ impl Drop for Rc { } } -#[unstable] +#[unstable = "Clone is unstable."] impl Clone for Rc { #[inline] fn clone(&self) -> Rc { @@ -278,6 +285,7 @@ impl Clone for Rc { } } +#[stable] impl Default for Rc { #[inline] fn default() -> Rc { @@ -285,6 +293,7 @@ impl Default for Rc { } } +#[unstable = "PartialEq is unstable."] impl PartialEq for Rc { #[inline(always)] fn eq(&self, other: &Rc) -> bool { **self == **other } @@ -292,8 +301,10 @@ impl PartialEq for Rc { fn ne(&self, other: &Rc) -> bool { **self != **other } } +#[unstable = "Eq is unstable."] impl Eq for Rc {} +#[unstable = "PartialOrd is unstable."] impl PartialOrd for Rc { #[inline(always)] fn partial_cmp(&self, other: &Rc) -> Option { @@ -313,11 +324,13 @@ impl PartialOrd for Rc { fn ge(&self, other: &Rc) -> bool { **self >= **other } } +#[unstable = "Ord is unstable."] impl Ord for Rc { #[inline] fn cmp(&self, other: &Rc) -> Ordering { (**self).cmp(&**other) } } +#[experimental = "Show is experimental."] impl fmt::Show for Rc { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { (**self).fmt(f) @@ -326,6 +339,7 @@ impl fmt::Show for Rc { /// Weak reference to a reference-counted box #[unsafe_no_drop_flag] +#[experimental = "Weak pointers may not belong in this module."] pub struct Weak { // FIXME #12808: strange names to try to avoid interfering with // field accesses of the contained type via Deref @@ -334,6 +348,7 @@ pub struct Weak { _noshare: marker::NoShare } +#[experimental = "Weak pointers may not belong in this module."] impl Weak { /// Upgrade a weak reference to a strong reference pub fn upgrade(&self) -> Option> { @@ -347,6 +362,7 @@ impl Weak { } #[unsafe_destructor] +#[experimental = "Weak pointers may not belong in this module."] impl Drop for Weak { fn drop(&mut self) { unsafe { @@ -364,6 +380,7 @@ impl Drop for Weak { } #[unstable] +#[experimental = "Weak pointers may not belong in this module."] impl Clone for Weak { #[inline] fn clone(&self) -> Weak {