diff options
| author | Nikolai Vazquez <nvazquez1297@gmail.com> | 2017-09-27 14:56:20 -0400 |
|---|---|---|
| committer | Nikolai Vazquez <nvazquez1297@gmail.com> | 2017-09-27 14:56:20 -0400 |
| commit | 36d663fcfc7a219f034ecdd219f03517e17db62d (patch) | |
| tree | 4d52665393e9a07ab1cb96b81275e74017f4ef0d /src/liballoc/boxed.rs | |
| parent | 930d3b17dd91b6564cf535ac717c688db757be5d (diff) | |
| download | rust-36d663fcfc7a219f034ecdd219f03517e17db62d.tar.gz rust-36d663fcfc7a219f034ecdd219f03517e17db62d.zip | |
Remove mem::transmute used in Box<str> conversions
Diffstat (limited to 'src/liballoc/boxed.rs')
| -rw-r--r-- | src/liballoc/boxed.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 4341b0b2975..35c8530b4dd 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -528,9 +528,7 @@ impl<'a> From<&'a str> for Box<str> { #[stable(feature = "boxed_str_conv", since = "1.19.0")] impl From<Box<str>> for Box<[u8]> { fn from(s: Box<str>) -> Self { - unsafe { - mem::transmute(s) - } + unsafe { Box::from_raw(Box::into_raw(s) as *mut [u8]) } } } |
