@@ -2357,7 +2357,7 @@ impl<T: Default> Default for Rc<T> {
2357
2357
/// assert_eq!(*x, 0);
2358
2358
/// ```
2359
2359
#[ inline]
2360
- fn default ( ) -> Rc < T > {
2360
+ fn default ( ) -> Self {
2361
2361
unsafe {
2362
2362
Self :: from_inner (
2363
2363
Box :: leak ( Box :: write (
@@ -2370,10 +2370,20 @@ impl<T: Default> Default for Rc<T> {
2370
2370
}
2371
2371
}
2372
2372
2373
+ #[ cfg( not( no_global_oom_handling) ) ]
2374
+ #[ stable( feature = "pin_default_impls" , since = "CURRENT_RUSTC_VERSION" ) ]
2375
+ impl < T : Default > Default for Pin < Rc < T > > {
2376
+ /// Creates a new pinned `Rc<T>`, with the `Default` value for `T`.
2377
+ #[ inline]
2378
+ fn default ( ) -> Self {
2379
+ unsafe { Pin :: new_unchecked ( Rc :: < T > :: default ( ) ) }
2380
+ }
2381
+ }
2382
+
2373
2383
#[ cfg( not( no_global_oom_handling) ) ]
2374
2384
#[ stable( feature = "more_rc_default_impls" , since = "1.80.0" ) ]
2375
2385
impl Default for Rc < str > {
2376
- /// Creates an empty str inside an Rc
2386
+ /// Creates an empty ` str` inside an `Rc`.
2377
2387
///
2378
2388
/// This may or may not share an allocation with other Rcs on the same thread.
2379
2389
#[ inline]
@@ -2387,7 +2397,7 @@ impl Default for Rc<str> {
2387
2397
#[ cfg( not( no_global_oom_handling) ) ]
2388
2398
#[ stable( feature = "more_rc_default_impls" , since = "1.80.0" ) ]
2389
2399
impl < T > Default for Rc < [ T ] > {
2390
- /// Creates an empty `[T]` inside an Rc
2400
+ /// Creates an empty `[T]` inside an `Rc`.
2391
2401
///
2392
2402
/// This may or may not share an allocation with other Rcs on the same thread.
2393
2403
#[ inline]
@@ -2397,6 +2407,16 @@ impl<T> Default for Rc<[T]> {
2397
2407
}
2398
2408
}
2399
2409
2410
+ #[ cfg( not( no_global_oom_handling) ) ]
2411
+ #[ stable( feature = "pin_default_impls" , since = "CURRENT_RUSTC_VERSION" ) ]
2412
+ impl < T > Default for Pin < Rc < [ T ] > > {
2413
+ /// Creates an empty `[T]` inside a pinned `Rc`.
2414
+ #[ inline]
2415
+ fn default ( ) -> Self {
2416
+ unsafe { Pin :: new_unchecked ( Rc :: < [ T ] > :: default ( ) ) }
2417
+ }
2418
+ }
2419
+
2400
2420
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2401
2421
trait RcEqIdent < T : ?Sized + PartialEq , A : Allocator > {
2402
2422
fn eq ( & self , other : & Rc < T , A > ) -> bool ;
0 commit comments