]> git.lizzy.rs Git - rust.git/commitdiff
alloc: Stabilize rc module.
authorBrian Anderson <banderson@mozilla.com>
Fri, 18 Jul 2014 23:02:14 +0000 (16:02 -0700)
committerBrian Anderson <banderson@mozilla.com>
Sat, 19 Jul 2014 01:34:38 +0000 (18:34 -0700)
Weak pointers experimental. Most everything else stable.

src/liballoc/rc.rs

index d97bce39c2de947693943229e618881f7bd5bfe7..8d4e788bc8035a0a5181fabd544ce95ce2a535d0 100644 (file)
@@ -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<T> {
 
 /// Immutable reference counted pointer type
 #[unsafe_no_drop_flag]
+#[stable]
 pub struct Rc<T> {
     // 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<T> {
     _noshare: marker::NoShare
 }
 
+#[stable]
 impl<T> Rc<T> {
     /// Construct a new reference-counted box
     pub fn new(value: T) -> Rc<T> {
@@ -203,6 +207,7 @@ pub fn new(value: T) -> Rc<T> {
 
 impl<T> Rc<T> {
     /// Downgrade the reference-counted pointer to a weak reference
+    #[experimental = "Weak pointers may not belong in this module."]
     pub fn downgrade(&self) -> Weak<T> {
         self.inc_weak();
         Weak {
@@ -238,6 +243,7 @@ pub fn make_unique<'a>(&'a mut self) -> &'a mut T {
     }
 }
 
+#[experimental = "Deref is experimental."]
 impl<T> Deref<T> for Rc<T> {
     /// Borrow the value contained in the reference-counted box
     #[inline(always)]
@@ -247,6 +253,7 @@ fn deref<'a>(&'a self) -> &'a T {
 }
 
 #[unsafe_destructor]
+#[experimental = "Drop is experimental."]
 impl<T> Drop for Rc<T> {
     fn drop(&mut self) {
         unsafe {
@@ -269,7 +276,7 @@ fn drop(&mut self) {
     }
 }
 
-#[unstable]
+#[unstable = "Clone is unstable."]
 impl<T> Clone for Rc<T> {
     #[inline]
     fn clone(&self) -> Rc<T> {
@@ -278,6 +285,7 @@ fn clone(&self) -> Rc<T> {
     }
 }
 
+#[stable]
 impl<T: Default> Default for Rc<T> {
     #[inline]
     fn default() -> Rc<T> {
@@ -285,6 +293,7 @@ fn default() -> Rc<T> {
     }
 }
 
+#[unstable = "PartialEq is unstable."]
 impl<T: PartialEq> PartialEq for Rc<T> {
     #[inline(always)]
     fn eq(&self, other: &Rc<T>) -> bool { **self == **other }
@@ -292,8 +301,10 @@ fn eq(&self, other: &Rc<T>) -> bool { **self == **other }
     fn ne(&self, other: &Rc<T>) -> bool { **self != **other }
 }
 
+#[unstable = "Eq is unstable."]
 impl<T: Eq> Eq for Rc<T> {}
 
+#[unstable = "PartialOrd is unstable."]
 impl<T: PartialOrd> PartialOrd for Rc<T> {
     #[inline(always)]
     fn partial_cmp(&self, other: &Rc<T>) -> Option<Ordering> {
@@ -313,11 +324,13 @@ fn gt(&self, other: &Rc<T>) -> bool { **self > **other }
     fn ge(&self, other: &Rc<T>) -> bool { **self >= **other }
 }
 
+#[unstable = "Ord is unstable."]
 impl<T: Ord> Ord for Rc<T> {
     #[inline]
     fn cmp(&self, other: &Rc<T>) -> Ordering { (**self).cmp(&**other) }
 }
 
+#[experimental = "Show is experimental."]
 impl<T: fmt::Show> fmt::Show for Rc<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         (**self).fmt(f)
@@ -326,6 +339,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 
 /// Weak reference to a reference-counted box
 #[unsafe_no_drop_flag]
+#[experimental = "Weak pointers may not belong in this module."]
 pub struct Weak<T> {
     // 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<T> {
     _noshare: marker::NoShare
 }
 
+#[experimental = "Weak pointers may not belong in this module."]
 impl<T> Weak<T> {
     /// Upgrade a weak reference to a strong reference
     pub fn upgrade(&self) -> Option<Rc<T>> {
@@ -347,6 +362,7 @@ pub fn upgrade(&self) -> Option<Rc<T>> {
 }
 
 #[unsafe_destructor]
+#[experimental = "Weak pointers may not belong in this module."]
 impl<T> Drop for Weak<T> {
     fn drop(&mut self) {
         unsafe {
@@ -364,6 +380,7 @@ fn drop(&mut self) {
 }
 
 #[unstable]
+#[experimental = "Weak pointers may not belong in this module."]
 impl<T> Clone for Weak<T> {
     #[inline]
     fn clone(&self) -> Weak<T> {