Add safe layout reprs and safety comments about layout

This commit is contained in:
Ross Smyth 2022-08-13 01:56:55 -04:00
parent f8a2f458b0
commit 80f14f61df
No known key found for this signature in database
GPG key ID: F1090CED11840CA3
5 changed files with 12 additions and 2 deletions

View file

@ -152,6 +152,7 @@ impl Symbol {
}
pub const fn to_ne_bytes(self) -> [u8; 8] {
// repr(packed(4)) is repr(c), and with the fields as defined will not having padding.
unsafe { std::mem::transmute(self) }
}