diff options
| author | Clar Charr <clar@charr.xyz> | 2017-04-11 16:02:43 -0400 |
|---|---|---|
| committer | Clar Charr <clar@charr.xyz> | 2017-04-24 17:51:49 -0400 |
| commit | c66c6e96978cd81130587e9f4d1fa52dc1b183d6 (patch) | |
| tree | 98339df32166aa47788c639e3f74de8776f3367c /src/libcollections/string.rs | |
| parent | 968ae7babecfc6c62ef9699ff052d9ab00411848 (diff) | |
More methods for str boxes.
Diffstat (limited to 'src/libcollections/string.rs')
| -rw-r--r-- | src/libcollections/string.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 8d6cf305112..69dfb466d70 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -56,10 +56,11 @@ #![stable(feature = "rust1", since = "1.0.0")] +use alloc::str as alloc_str; + use core::fmt; use core::hash; use core::iter::{FromIterator, FusedIterator}; -use core::mem; use core::ops::{self, Add, AddAssign, Index, IndexMut}; use core::ptr; use core::str as core_str; @@ -1398,7 +1399,7 @@ impl String { #[stable(feature = "box_str", since = "1.4.0")] pub fn into_boxed_str(self) -> Box<str> { let slice = self.vec.into_boxed_slice(); - unsafe { mem::transmute::<Box<[u8]>, Box<str>>(slice) } + unsafe { alloc_str::from_boxed_utf8_unchecked(slice) } } } |
