From ed7b47d731274e1608ec9f5953fdc9ddf7cc278b Mon Sep 17 00:00:00 2001 From: Aito Stukas Date: Thu, 25 Apr 2024 19:58:32 +1000 Subject: [PATCH] Implemented Default for Arc --- library/alloc/src/boxed.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs index e5d62447eb20e..2f5a4beaea2fd 100644 --- a/library/alloc/src/boxed.rs +++ b/library/alloc/src/boxed.rs @@ -183,6 +183,9 @@ use crate::vec::Vec; #[unstable(feature = "thin_box", issue = "92791")] pub use thin::ThinBox; +#[cfg(not(no_global_oom_handling))] +use crate::sync::Arc; + mod thin; /// A pointer type that uniquely owns a heap allocation of type `T`. @@ -1284,6 +1287,15 @@ impl Default for Box { } } +#[cfg(not(no_global_oom_handling))] +#[stable(feature = "rust1", since = "1.0.0")] +impl Default for Arc { + #[inline] + fn default() -> Self { + Arc::from("") + } +} + #[cfg(not(no_global_oom_handling))] #[stable(feature = "rust1", since = "1.0.0")] impl Clone for Box {