@@ -24,9 +24,9 @@ struct RcBox<T> {
24
24
}
25
25
26
26
/// Immutable reference counted pointer type
27
+ #[ non_owned]
27
28
pub struct Rc < T > {
28
29
priv ptr: * mut RcBox < T > ,
29
- priv non_owned : Option < @( ) > // FIXME: #5601: replace with `#[non_owned]`
30
30
}
31
31
32
32
pub impl < ' self , T : Owned > Rc < T > {
@@ -35,7 +35,7 @@ pub impl<'self, T: Owned> Rc<T> {
35
35
let ptr = malloc ( sys:: size_of :: < RcBox < T > > ( ) as size_t ) as * mut RcBox < T > ;
36
36
assert ! ( !ptr:: is_null( ptr) ) ;
37
37
intrinsics:: move_val_init ( & mut * ptr, RcBox { value : value, count : 1 } ) ;
38
- Rc { ptr : ptr, non_owned : None }
38
+ Rc { ptr : ptr}
39
39
}
40
40
}
41
41
@@ -64,7 +64,7 @@ impl<T: Owned> Clone for Rc<T> {
64
64
fn clone ( & self ) -> Rc < T > {
65
65
unsafe {
66
66
( * self . ptr ) . count += 1 ;
67
- Rc { ptr : self . ptr , non_owned : None }
67
+ Rc { ptr : self . ptr }
68
68
}
69
69
}
70
70
}
@@ -113,9 +113,10 @@ struct RcMutBox<T> {
113
113
}
114
114
115
115
/// Mutable reference counted pointer type
116
+ #[ non_owned]
117
+ #[ mutable]
116
118
pub struct RcMut < T > {
117
119
priv ptr: * mut RcMutBox < T > ,
118
- priv non_owned : Option < @mut ( ) > // FIXME: #5601: replace with `#[non_owned]` and `#[non_const]`
119
120
}
120
121
121
122
pub impl < ' self , T : Owned > RcMut < T > {
@@ -124,7 +125,7 @@ pub impl<'self, T: Owned> RcMut<T> {
124
125
let ptr = malloc ( sys:: size_of :: < RcMutBox < T > > ( ) as size_t ) as * mut RcMutBox < T > ;
125
126
assert ! ( !ptr:: is_null( ptr) ) ;
126
127
intrinsics:: move_val_init ( & mut * ptr, RcMutBox { value : value, count : 1 , borrow : Nothing } ) ;
127
- RcMut { ptr : ptr, non_owned : None }
128
+ RcMut { ptr : ptr}
128
129
}
129
130
}
130
131
@@ -171,7 +172,7 @@ impl<T: Owned> Clone for RcMut<T> {
171
172
fn clone ( & self ) -> RcMut < T > {
172
173
unsafe {
173
174
( * self . ptr ) . count += 1 ;
174
- RcMut { ptr : self . ptr , non_owned : None }
175
+ RcMut { ptr : self . ptr }
175
176
}
176
177
}
177
178
}
0 commit comments