@@ -24,9 +24,9 @@ struct RcBox<T> {
2424}
2525
2626/// Immutable reference counted pointer type
27+ #[ non_owned]
2728pub struct Rc < T > {
2829 priv ptr: * mut RcBox < T > ,
29- priv non_owned : Option < @( ) > // FIXME: #5601: replace with `#[non_owned]`
3030}
3131
3232pub impl < ' self , T : Owned > Rc < T > {
@@ -35,7 +35,7 @@ pub impl<'self, T: Owned> Rc<T> {
3535 let ptr = malloc ( sys:: size_of :: < RcBox < T > > ( ) as size_t ) as * mut RcBox < T > ;
3636 assert ! ( !ptr:: is_null( ptr) ) ;
3737 intrinsics:: move_val_init ( & mut * ptr, RcBox { value : value, count : 1 } ) ;
38- Rc { ptr : ptr, non_owned : None }
38+ Rc { ptr : ptr}
3939 }
4040 }
4141
@@ -64,7 +64,7 @@ impl<T: Owned> Clone for Rc<T> {
6464 fn clone ( & self ) -> Rc < T > {
6565 unsafe {
6666 ( * self . ptr ) . count += 1 ;
67- Rc { ptr : self . ptr , non_owned : None }
67+ Rc { ptr : self . ptr }
6868 }
6969 }
7070}
@@ -113,9 +113,10 @@ struct RcMutBox<T> {
113113}
114114
115115/// Mutable reference counted pointer type
116+ #[ non_owned]
117+ #[ mutable]
116118pub struct RcMut < T > {
117119 priv ptr: * mut RcMutBox < T > ,
118- priv non_owned : Option < @mut ( ) > // FIXME: #5601: replace with `#[non_owned]` and `#[non_const]`
119120}
120121
121122pub impl < ' self , T : Owned > RcMut < T > {
@@ -124,7 +125,7 @@ pub impl<'self, T: Owned> RcMut<T> {
124125 let ptr = malloc ( sys:: size_of :: < RcMutBox < T > > ( ) as size_t ) as * mut RcMutBox < T > ;
125126 assert ! ( !ptr:: is_null( ptr) ) ;
126127 intrinsics:: move_val_init ( & mut * ptr, RcMutBox { value : value, count : 1 , borrow : Nothing } ) ;
127- RcMut { ptr : ptr, non_owned : None }
128+ RcMut { ptr : ptr}
128129 }
129130 }
130131
@@ -171,7 +172,7 @@ impl<T: Owned> Clone for RcMut<T> {
171172 fn clone ( & self ) -> RcMut < T > {
172173 unsafe {
173174 ( * self . ptr ) . count += 1 ;
174- RcMut { ptr : self . ptr , non_owned : None }
175+ RcMut { ptr : self . ptr }
175176 }
176177 }
177178}
0 commit comments