@@ -56,12 +56,23 @@ Most primitives are generally aligned to their size, although this is
5656platform-specific behavior. In particular, on x86 u64 and f64 are only
5757aligned to 32 bits.
5858
59+ For the primitive numeric types (` u8 ` , ` i8 ` , ` u16 ` , ` i16 ` , ` u32 ` , ` i32 ` , ` u64 ` ,
60+ ` i64 ` , ` u128 ` , ` i128 ` , ` usize ` , ` isize ` , ` f32 ` , and ` f64 ` ), every bit pattern
61+ represents a valid instance of the type (in other words,
62+ ` transmute::<[u8; size_of::<T>()], T>(...) ` is always sound). For the primitive
63+ numeric types and also for ` bool ` and ` char ` , every byte is guaranteed to be
64+ initialized (in other words, `transmute::<T, [ u8; size_of::<T >()] >(...) is always
65+ sound).
66+
5967## Pointers and References Layout
6068
6169Pointers and references have the same layout. Mutability of the pointer or
6270reference does not change the layout.
6371
64- Pointers to sized types have the same size and alignment as ` usize ` .
72+ Pointers to sized types have the same size and alignment as ` usize ` . Every
73+ byte of a pointer to a sized type and of a reference to a sized type is
74+ initialized (in other words, for such a pointer or reference type, ` P ` ,
75+ ` transmute::<P, [u8; size_of::<P>()]>(...) ` is always sound).
6576
6677Pointers to unsized types are sized. The size and alignment is guaranteed to be
6778at least equal to the size and alignment of a pointer.
0 commit comments