diff options
| author | Nikolai Vazquez <nvazquez1297@gmail.com> | 2017-12-25 17:04:45 -0500 |
|---|---|---|
| committer | Nikolai Vazquez <nvazquez1297@gmail.com> | 2017-12-25 17:04:45 -0500 |
| commit | 0fbcb7b873d140341fcfead9c47b1468617a596f (patch) | |
| tree | be5a4395675d7a5bd7eb67f7e8b153fb28851def /src/liballoc/arc.rs | |
| parent | 4a7c072fa61b42f96d8b75c37fc1edfd71172695 (diff) | |
| download | rust-0fbcb7b873d140341fcfead9c47b1468617a596f.tar.gz rust-0fbcb7b873d140341fcfead9c47b1468617a596f.zip | |
Remove transmute in From<&str> impls for Arc/Rc
Diffstat (limited to 'src/liballoc/arc.rs')
| -rw-r--r-- | src/liballoc/arc.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 844b7083593..185af8835d1 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -1377,7 +1377,8 @@ impl<'a, T: Clone> From<&'a [T]> for Arc<[T]> { impl<'a> From<&'a str> for Arc<str> { #[inline] fn from(v: &str) -> Arc<str> { - unsafe { mem::transmute(<Arc<[u8]>>::from(v.as_bytes())) } + let arc = Arc::<[u8]>::from(v.as_bytes()); + unsafe { Arc::from_raw(Arc::into_raw(arc) as *const str) } } } |
