@@ -148,6 +148,8 @@ fn main() {
148
148
149
149
*/
150
150
151
+ #![ stable]
152
+
151
153
use core:: mem:: transmute;
152
154
use core:: cell:: Cell ;
153
155
use core:: clone:: Clone ;
@@ -171,6 +173,7 @@ struct RcBox<T> {
171
173
172
174
/// Immutable reference counted pointer type
173
175
#[ unsafe_no_drop_flag]
176
+ #[ stable]
174
177
pub struct Rc < T > {
175
178
// FIXME #12808: strange names to try to avoid interfering with
176
179
// field accesses of the contained type via Deref
@@ -179,6 +182,7 @@ pub struct Rc<T> {
179
182
_noshare : marker:: NoShare
180
183
}
181
184
185
+ #[ stable]
182
186
impl < T > Rc < T > {
183
187
/// Construct a new reference-counted box
184
188
pub fn new ( value : T ) -> Rc < T > {
@@ -203,6 +207,7 @@ impl<T> Rc<T> {
203
207
204
208
impl < T > Rc < T > {
205
209
/// Downgrade the reference-counted pointer to a weak reference
210
+ #[ experimental = "Weak pointers may not belong in this module." ]
206
211
pub fn downgrade ( & self ) -> Weak < T > {
207
212
self . inc_weak ( ) ;
208
213
Weak {
@@ -238,6 +243,7 @@ impl<T: Clone> Rc<T> {
238
243
}
239
244
}
240
245
246
+ #[ experimental = "Deref is experimental." ]
241
247
impl < T > Deref < T > for Rc < T > {
242
248
/// Borrow the value contained in the reference-counted box
243
249
#[ inline( always) ]
@@ -247,6 +253,7 @@ impl<T> Deref<T> for Rc<T> {
247
253
}
248
254
249
255
#[ unsafe_destructor]
256
+ #[ experimental = "Drop is experimental." ]
250
257
impl < T > Drop for Rc < T > {
251
258
fn drop ( & mut self ) {
252
259
unsafe {
@@ -269,7 +276,7 @@ impl<T> Drop for Rc<T> {
269
276
}
270
277
}
271
278
272
- #[ unstable]
279
+ #[ unstable = "Clone is unstable." ]
273
280
impl < T > Clone for Rc < T > {
274
281
#[ inline]
275
282
fn clone ( & self ) -> Rc < T > {
@@ -278,22 +285,26 @@ impl<T> Clone for Rc<T> {
278
285
}
279
286
}
280
287
288
+ #[ stable]
281
289
impl < T : Default > Default for Rc < T > {
282
290
#[ inline]
283
291
fn default ( ) -> Rc < T > {
284
292
Rc :: new ( Default :: default ( ) )
285
293
}
286
294
}
287
295
296
+ #[ unstable = "PartialEq is unstable." ]
288
297
impl < T : PartialEq > PartialEq for Rc < T > {
289
298
#[ inline( always) ]
290
299
fn eq ( & self , other : & Rc < T > ) -> bool { * * self == * * other }
291
300
#[ inline( always) ]
292
301
fn ne ( & self , other : & Rc < T > ) -> bool { * * self != * * other }
293
302
}
294
303
304
+ #[ unstable = "Eq is unstable." ]
295
305
impl < T : Eq > Eq for Rc < T > { }
296
306
307
+ #[ unstable = "PartialOrd is unstable." ]
297
308
impl < T : PartialOrd > PartialOrd for Rc < T > {
298
309
#[ inline( always) ]
299
310
fn partial_cmp ( & self , other : & Rc < T > ) -> Option < Ordering > {
@@ -313,11 +324,13 @@ impl<T: PartialOrd> PartialOrd for Rc<T> {
313
324
fn ge ( & self , other : & Rc < T > ) -> bool { * * self >= * * other }
314
325
}
315
326
327
+ #[ unstable = "Ord is unstable." ]
316
328
impl < T : Ord > Ord for Rc < T > {
317
329
#[ inline]
318
330
fn cmp ( & self , other : & Rc < T > ) -> Ordering { ( * * self ) . cmp ( & * * other) }
319
331
}
320
332
333
+ #[ experimental = "Show is experimental." ]
321
334
impl < T : fmt:: Show > fmt:: Show for Rc < T > {
322
335
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
323
336
( * * self ) . fmt ( f)
@@ -326,6 +339,7 @@ impl<T: fmt::Show> fmt::Show for Rc<T> {
326
339
327
340
/// Weak reference to a reference-counted box
328
341
#[ unsafe_no_drop_flag]
342
+ #[ experimental = "Weak pointers may not belong in this module." ]
329
343
pub struct Weak < T > {
330
344
// FIXME #12808: strange names to try to avoid interfering with
331
345
// field accesses of the contained type via Deref
@@ -334,6 +348,7 @@ pub struct Weak<T> {
334
348
_noshare : marker:: NoShare
335
349
}
336
350
351
+ #[ experimental = "Weak pointers may not belong in this module." ]
337
352
impl < T > Weak < T > {
338
353
/// Upgrade a weak reference to a strong reference
339
354
pub fn upgrade ( & self ) -> Option < Rc < T > > {
@@ -347,6 +362,7 @@ impl<T> Weak<T> {
347
362
}
348
363
349
364
#[ unsafe_destructor]
365
+ #[ experimental = "Weak pointers may not belong in this module." ]
350
366
impl < T > Drop for Weak < T > {
351
367
fn drop ( & mut self ) {
352
368
unsafe {
@@ -364,6 +380,7 @@ impl<T> Drop for Weak<T> {
364
380
}
365
381
366
382
#[ unstable]
383
+ #[ experimental = "Weak pointers may not belong in this module." ]
367
384
impl < T > Clone for Weak < T > {
368
385
#[ inline]
369
386
fn clone ( & self ) -> Weak < T > {
0 commit comments