about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-05-08 00:21:38 -0700
committerbors <bors@rust-lang.org>2013-05-08 00:21:38 -0700
commit625e518ffefaacb95c9bdc0544bc5771cc7a0928 (patch)
tree895808860a0abc4875110fc72b4189b62f195ef2 /src/libstd
parent86500fbb134032ed28129272ef9fb3873934dd1b (diff)
parent96eb1e50a49ce24adf198458e3d09fcd1117a70f (diff)
downloadrust-625e518ffefaacb95c9bdc0544bc5771cc7a0928.tar.gz
rust-625e518ffefaacb95c9bdc0544bc5771cc7a0928.zip
auto merge of #6305 : thestinger/rust/rc, r=nikomatsakis
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/arc.rs1
-rw-r--r--src/libstd/rc.rs13
2 files changed, 8 insertions, 6 deletions
diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs
index 98d7a01b928..6c39fa1f9dc 100644
--- a/src/libstd/arc.rs
+++ b/src/libstd/arc.rs
@@ -252,6 +252,7 @@ struct RWARCInner<T> { lock: RWlock, failed: bool, data: T }
  *
  * Unlike mutex_arcs, rw_arcs are safe, because they cannot be nested.
  */
+#[mutable]
 struct RWARC<T> {
     x: SharedMutableState<RWARCInner<T>>,
     cant_nest: ()
diff --git a/src/libstd/rc.rs b/src/libstd/rc.rs
index 3eb480f9ea8..6f72d8dc16d 100644
--- a/src/libstd/rc.rs
+++ b/src/libstd/rc.rs
@@ -24,9 +24,9 @@ struct RcBox<T> {
 }
 
 /// Immutable reference counted pointer type
+#[non_owned]
 pub struct Rc<T> {
     priv ptr: *mut RcBox<T>,
-    priv non_owned: Option<@()> // FIXME: #5601: replace with `#[non_owned]`
 }
 
 pub impl<'self, T: Owned> Rc<T> {
@@ -35,7 +35,7 @@ pub impl<'self, T: Owned> Rc<T> {
             let ptr = malloc(sys::size_of::<RcBox<T>>() as size_t) as *mut RcBox<T>;
             assert!(!ptr::is_null(ptr));
             intrinsics::move_val_init(&mut *ptr, RcBox{value: value, count: 1});
-            Rc{ptr: ptr, non_owned: None}
+            Rc{ptr: ptr}
         }
     }
 
@@ -64,7 +64,7 @@ impl<T: Owned> Clone for Rc<T> {
     fn clone(&self) -> Rc<T> {
         unsafe {
             (*self.ptr).count += 1;
-            Rc{ptr: self.ptr, non_owned: None}
+            Rc{ptr: self.ptr}
         }
     }
 }
@@ -113,9 +113,10 @@ struct RcMutBox<T> {
 }
 
 /// Mutable reference counted pointer type
+#[non_owned]
+#[mutable]
 pub struct RcMut<T> {
     priv ptr: *mut RcMutBox<T>,
-    priv non_owned: Option<@mut ()> // FIXME: #5601: replace with `#[non_owned]` and `#[non_const]`
 }
 
 pub impl<'self, T: Owned> RcMut<T> {
@@ -124,7 +125,7 @@ pub impl<'self, T: Owned> RcMut<T> {
             let ptr = malloc(sys::size_of::<RcMutBox<T>>() as size_t) as *mut RcMutBox<T>;
             assert!(!ptr::is_null(ptr));
             intrinsics::move_val_init(&mut *ptr, RcMutBox{value: value, count: 1, borrow: Nothing});
-            RcMut{ptr: ptr, non_owned: None}
+            RcMut{ptr: ptr}
         }
     }
 
@@ -171,7 +172,7 @@ impl<T: Owned> Clone for RcMut<T> {
     fn clone(&self) -> RcMut<T> {
         unsafe {
             (*self.ptr).count += 1;
-            RcMut{ptr: self.ptr, non_owned: None}
+            RcMut{ptr: self.ptr}
         }
     }
 }