Commit 7391009
authored
Rollup merge of #63980 - DutchGhost:master, r=cramertj
add missing `#[repr(C)]` on the Slices union
Adds the `#[repr(C)]` attribute to the `Slices` union used to convert an `&str` into a `&[u8]`.
Without the attribute, the union has an unspecified layout: https://doc.rust-lang.org/reference/types/union.html, so performing the 'transmute' is unsound without the attribute (as far as I understand).
The `Repr` union, used for converting a raw ptr + len to a slice has this attribute as well:
https://github.com/rust-lang/rust/blob/master/src/libcore/ptr/mod.rs#L211-#L2161 file changed
+1
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2170 | 2170 | | |
2171 | 2171 | | |
2172 | 2172 | | |
| 2173 | + | |
2173 | 2174 | | |
2174 | 2175 | | |
2175 | 2176 | | |
| |||
0 commit comments