about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorClar Charr <clar@charr.xyz>2017-01-31 22:46:16 -0500
committerClar Charr <clar@charr.xyz>2017-02-14 14:18:43 -0500
commit963843b1b346278fcf6f7f065cabdaaae775a0a1 (patch)
tree5479442c7fb7a6e7d1c484340246dda7004113dd /src/liballoc
parent2425b227742bb9214d60429d1325816e0b93e152 (diff)
downloadrust-963843b1b346278fcf6f7f065cabdaaae775a0a1.tar.gz
rust-963843b1b346278fcf6f7f065cabdaaae775a0a1.zip
Conversions between CStr/OsStr/Path and boxes.
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/boxed.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs
index ac9439974a4..d0fce706128 100644
--- a/src/liballoc/boxed.rs
+++ b/src/liballoc/boxed.rs
@@ -315,6 +315,14 @@ impl<T> Default for Box<[T]> {
     }
 }
 
+#[stable(feature = "default_box_extra", since = "1.17.0")]
+impl Default for Box<str> {
+    fn default() -> Box<str> {
+        let default: Box<[u8]> = Default::default();
+        unsafe { mem::transmute(default) }
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: Clone> Clone for Box<T> {
     /// Returns a new box with a `clone()` of this box's contents.