Clarify that any alignment is valid for ZSTs

pull/248/head
unknown 4 years ago committed by Alexis Beingessner
parent 23c49f1d5c
commit d8383b65f7

@ -11,10 +11,10 @@ Primitives are usually aligned to their size, although this is
platform-specific behavior. For example, on x86 `u64` and `f64` are often platform-specific behavior. For example, on x86 `u64` and `f64` are often
aligned to 4 bytes (32 bits). aligned to 4 bytes (32 bits).
A type's size must always be a multiple of its alignment. This ensures that an A type's size must always be a multiple of its alignment (Zero being a valid size
array of that type may always be indexed by offsetting by a multiple of its for any alignment). This ensures that an array of that type may always be indexed
size. Note that the size and alignment of a type may not be known by offsetting by a multiple of its size. Note that the size and alignment of a
statically in the case of [dynamically sized types][dst]. type may not be known statically in the case of [dynamically sized types][dst].
Rust gives you the following ways to lay out composite data: Rust gives you the following ways to lay out composite data:

Loading…
Cancel
Save