@@ -2357,7 +2357,7 @@ impl<T: Default> Default for Rc<T> {
23572357 /// assert_eq!(*x, 0);
23582358 /// ```
23592359 #[ inline]
2360- fn default ( ) -> Rc < T > {
2360+ fn default ( ) -> Self {
23612361 unsafe {
23622362 Self :: from_inner (
23632363 Box :: leak ( Box :: write (
@@ -2370,10 +2370,20 @@ impl<T: Default> Default for Rc<T> {
23702370 }
23712371}
23722372
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+
23732383#[ cfg( not( no_global_oom_handling) ) ]
23742384#[ stable( feature = "more_rc_default_impls" , since = "1.80.0" ) ]
23752385impl Default for Rc < str > {
2376- /// Creates an empty str inside an Rc
2386+ /// Creates an empty ` str` inside an `Rc`.
23772387 ///
23782388 /// This may or may not share an allocation with other Rcs on the same thread.
23792389 #[ inline]
@@ -2387,7 +2397,7 @@ impl Default for Rc<str> {
23872397#[ cfg( not( no_global_oom_handling) ) ]
23882398#[ stable( feature = "more_rc_default_impls" , since = "1.80.0" ) ]
23892399impl < T > Default for Rc < [ T ] > {
2390- /// Creates an empty `[T]` inside an Rc
2400+ /// Creates an empty `[T]` inside an `Rc`.
23912401 ///
23922402 /// This may or may not share an allocation with other Rcs on the same thread.
23932403 #[ inline]
@@ -2397,6 +2407,16 @@ impl<T> Default for Rc<[T]> {
23972407 }
23982408}
23992409
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+
24002420#[ stable( feature = "rust1" , since = "1.0.0" ) ]
24012421trait RcEqIdent < T : ?Sized + PartialEq , A : Allocator > {
24022422 fn eq ( & self , other : & Rc < T , A > ) -> bool ;
0 commit comments