diff options
| author | Nikolai Vazquez <nvazquez1297@gmail.com> | 2017-09-30 10:01:41 -0400 |
|---|---|---|
| committer | Nikolai Vazquez <nvazquez1297@gmail.com> | 2017-09-30 10:01:41 -0400 |
| commit | f1798d3c9ab22be8f3b6f9f60f5e027be1a02085 (patch) | |
| tree | f521265b238b3d5105df1c6ed3f66ff0b69bfded /src/libstd | |
| parent | cb2a656cdfb6400ac0200c661267f91fabf237e2 (diff) | |
Cast inner type in OsStr::bytes
The innermost type is not [u8] on all platforms but is assumed to have the same memory layout as [u8] since this conversion was done via mem::transmute before.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/ffi/os_str.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index cfa9ecca019..88ee5c9a734 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -520,7 +520,7 @@ impl OsStr { /// Note: it is *crucial* that this API is private, to avoid /// revealing the internal, platform-specific encodings. fn bytes(&self) -> &[u8] { - &self.inner.inner + unsafe { &*(&self.inner as *const _ as *const [u8]) } } } |
