Update src/liballoc/boxed.rs

Co-Authored-By: Ralf Jung <post@ralfj.de>
This commit is contained in:
Aleksey Kladov 2019-05-27 22:42:50 +03:00 committed by GitHub
parent 0653e78ae1
commit fe31ad38cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -395,6 +395,7 @@ impl<T: Clone> Clone for Box<T> {
#[stable(feature = "box_slice_clone", since = "1.3.0")]
impl Clone for Box<str> {
fn clone(&self) -> Self {
// this makes a copy of the data
let buf: Box<[u8]> = self.as_bytes().into();
unsafe {
from_boxed_utf8_unchecked(buf)