mirror of
https://github.com/Lokathor/bytemuck.git
synced 2024-11-25 08:12:26 +00:00
Pod safety documentation change
The previous requirements were incorrect because I misunderstood how `repr(packed)` actually means `repr(Rust, packed)` rather than `repr(C, packed)` as I first assumed. Closes https://github.com/Lokathor/bytemuck/issues/14
This commit is contained in:
parent
481c6879ec
commit
f5d5523f77
@ -23,7 +23,9 @@ use super::*;
|
||||
/// middle, and also no `#[repr(C)] struct Foo(u16, u8)`, which has padding on
|
||||
/// the end).
|
||||
/// * The type needs to have all fields also be `Pod`.
|
||||
/// * The type needs to be `repr(C)`, `repr(transparent)`, or `repr(packed)`.
|
||||
/// * The type needs to be `repr(C)` or `repr(transparent)`. In the case of
|
||||
/// `repr(C)`, the `packed` and `align` repr modifiers can be used as long as
|
||||
/// all other rules end up being followed.
|
||||
pub unsafe trait Pod: Zeroable + Copy + 'static {}
|
||||
|
||||
unsafe impl Pod for () {}
|
||||
|
Loading…
Reference in New Issue
Block a user