about summary refs log tree commit diff
path: root/library/alloc/src/ffi/c_str.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/alloc/src/ffi/c_str.rs')
-rw-r--r--library/alloc/src/ffi/c_str.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/library/alloc/src/ffi/c_str.rs b/library/alloc/src/ffi/c_str.rs
index f143e557871..19dd90eb81f 100644
--- a/library/alloc/src/ffi/c_str.rs
+++ b/library/alloc/src/ffi/c_str.rs
@@ -910,6 +910,28 @@ impl From<&CStr> for Rc<CStr> {
     }
 }
 
+#[cfg(not(no_global_oom_handling))]
+#[stable(feature = "more_rc_default_impls", since = "CURRENT_RUSTC_VERSION")]
+impl Default for Arc<CStr> {
+    /// Creates an empty CStr inside an Arc
+    #[inline]
+    fn default() -> Self {
+        let c_str: &CStr = Default::default();
+        Arc::from(c_str)
+    }
+}
+
+#[cfg(not(no_global_oom_handling))]
+#[stable(feature = "more_rc_default_impls", since = "CURRENT_RUSTC_VERSION")]
+impl Default for Rc<CStr> {
+    /// Creates an empty CStr inside an Rc
+    #[inline]
+    fn default() -> Self {
+        let c_str: &CStr = Default::default();
+        Rc::from(c_str)
+    }
+}
+
 #[cfg(not(test))]
 #[stable(feature = "default_box_extra", since = "1.17.0")]
 impl Default for Box<CStr> {