diff --git a/alloc/src/rc.rs b/alloc/src/rc.rs index e98ae7c31ad06..582d850e14b6d 100644 --- a/alloc/src/rc.rs +++ b/alloc/src/rc.rs @@ -2312,7 +2312,16 @@ impl Default for Rc { /// ``` #[inline] fn default() -> Rc { - Rc::new(Default::default()) + unsafe { + Self::from_inner( + Box::leak(Box::write(Box::new_uninit(), RcInner { + strong: Cell::new(1), + weak: Cell::new(1), + value: T::default(), + })) + .into(), + ) + } } }