15
15
//!
16
16
//! [`Rc`] uses non-atomic reference counting. This means that overhead is very
17
17
//! low, but an [`Rc`] cannot be sent between threads, and consequently [`Rc`]
18
- //! does not implement [`Send`][send] . As a result, the Rust compiler
18
+ //! does not implement [`Send`]. As a result, the Rust compiler
19
19
//! will check *at compile time* that you are not sending [`Rc`]s between
20
20
//! threads. If you need multi-threaded, atomic reference counting, use
21
21
//! [`sync::Arc`][arc].
232
232
//! [clone]: Clone::clone
233
233
//! [`Cell`]: core::cell::Cell
234
234
//! [`RefCell`]: core::cell::RefCell
235
- //! [send]: core::marker::Send
236
235
//! [arc]: crate::sync::Arc
237
236
//! [`Deref`]: core::ops::Deref
238
237
//! [downgrade]: Rc::downgrade
@@ -251,13 +250,12 @@ use core::any::Any;
251
250
use core:: borrow;
252
251
use core:: cell:: Cell ;
253
252
use core:: cmp:: Ordering ;
254
- use core:: convert:: { From , TryFrom } ;
255
253
use core:: fmt;
256
254
use core:: hash:: { Hash , Hasher } ;
257
255
use core:: intrinsics:: abort;
258
256
#[ cfg( not( no_global_oom_handling) ) ]
259
257
use core:: iter;
260
- use core:: marker:: { self , PhantomData , Unpin , Unsize } ;
258
+ use core:: marker:: { PhantomData , Unsize } ;
261
259
#[ cfg( not( no_global_oom_handling) ) ]
262
260
use core:: mem:: size_of_val;
263
261
use core:: mem:: { self , align_of_val_raw, forget} ;
@@ -321,15 +319,15 @@ pub struct Rc<T: ?Sized> {
321
319
}
322
320
323
321
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
324
- impl < T : ?Sized > !marker :: Send for Rc < T > { }
322
+ impl < T : ?Sized > !Send for Rc < T > { }
325
323
326
324
// Note that this negative impl isn't strictly necessary for correctness,
327
325
// as `Rc` transitively contains a `Cell`, which is itself `!Sync`.
328
326
// However, given how important `Rc`'s `!Sync`-ness is,
329
327
// having an explicit negative impl is nice for documentation purposes
330
328
// and results in nicer error messages.
331
329
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
332
- impl < T : ?Sized > !marker :: Sync for Rc < T > { }
330
+ impl < T : ?Sized > !Sync for Rc < T > { }
333
331
334
332
#[ stable( feature = "catch_unwind" , since = "1.9.0" ) ]
335
333
impl < T : RefUnwindSafe + ?Sized > UnwindSafe for Rc < T > { }
@@ -1060,7 +1058,7 @@ impl<T: ?Sized> Rc<T> {
1060
1058
#[ inline]
1061
1059
#[ stable( feature = "rc_mutate_strong_count" , since = "1.53.0" ) ]
1062
1060
pub unsafe fn decrement_strong_count ( ptr : * const T ) {
1063
- unsafe { mem :: drop ( Rc :: from_raw ( ptr) ) } ;
1061
+ unsafe { drop ( Rc :: from_raw ( ptr) ) } ;
1064
1062
}
1065
1063
1066
1064
/// Returns `true` if there are no other `Rc` or [`Weak`] pointers to
@@ -1496,7 +1494,7 @@ impl<T> Rc<[T]> {
1496
1494
///
1497
1495
/// Behavior is undefined should the size be wrong.
1498
1496
#[ cfg( not( no_global_oom_handling) ) ]
1499
- unsafe fn from_iter_exact ( iter : impl iter :: Iterator < Item = T > , len : usize ) -> Rc < [ T ] > {
1497
+ unsafe fn from_iter_exact ( iter : impl Iterator < Item = T > , len : usize ) -> Rc < [ T ] > {
1500
1498
// Panic guard while cloning T elements.
1501
1499
// In the event of a panic, elements that have been written
1502
1500
// into the new RcBox will be dropped, then the memory freed.
@@ -2088,7 +2086,7 @@ impl<T, const N: usize> TryFrom<Rc<[T]>> for Rc<[T; N]> {
2088
2086
2089
2087
#[ cfg( not( no_global_oom_handling) ) ]
2090
2088
#[ stable( feature = "shared_from_iter" , since = "1.37.0" ) ]
2091
- impl < T > iter :: FromIterator < T > for Rc < [ T ] > {
2089
+ impl < T > FromIterator < T > for Rc < [ T ] > {
2092
2090
/// Takes each element in the `Iterator` and collects it into an `Rc<[T]>`.
2093
2091
///
2094
2092
/// # Performance characteristics
@@ -2127,7 +2125,7 @@ impl<T> iter::FromIterator<T> for Rc<[T]> {
2127
2125
/// let evens: Rc<[u8]> = (0..10).collect(); // Just a single allocation happens here.
2128
2126
/// # assert_eq!(&*evens, &*(0..10).collect::<Vec<_>>());
2129
2127
/// ```
2130
- fn from_iter < I : iter :: IntoIterator < Item = T > > ( iter : I ) -> Self {
2128
+ fn from_iter < I : IntoIterator < Item = T > > ( iter : I ) -> Self {
2131
2129
ToRcSlice :: to_rc_slice ( iter. into_iter ( ) )
2132
2130
}
2133
2131
}
@@ -2204,9 +2202,9 @@ pub struct Weak<T: ?Sized> {
2204
2202
}
2205
2203
2206
2204
#[ stable( feature = "rc_weak" , since = "1.4.0" ) ]
2207
- impl < T : ?Sized > !marker :: Send for Weak < T > { }
2205
+ impl < T : ?Sized > !Send for Weak < T > { }
2208
2206
#[ stable( feature = "rc_weak" , since = "1.4.0" ) ]
2209
- impl < T : ?Sized > !marker :: Sync for Weak < T > { }
2207
+ impl < T : ?Sized > !Sync for Weak < T > { }
2210
2208
2211
2209
#[ unstable( feature = "coerce_unsized" , issue = "18598" ) ]
2212
2210
impl < T : ?Sized + Unsize < U > , U : ?Sized > CoerceUnsized < Weak < U > > for Weak < T > { }
0 commit comments