From 5ccb038df7387adbb22c780b7f7f599c64bfc297 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 22 Nov 2020 10:17:35 -0300 Subject: [PATCH] Clarify that any alignment is valid for ZSTs --- src/repr-rust.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/repr-rust.md b/src/repr-rust.md index 584a9a0..7baed6e 100644 --- a/src/repr-rust.md +++ b/src/repr-rust.md @@ -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 aligned to 4 bytes (32 bits). -A type's size must always be a multiple of its alignment. This ensures that an -array of that type may always be indexed by offsetting by a multiple of its -size. Note that the size and alignment of a type may not be known -statically in the case of [dynamically sized types][dst]. +A type's size must always be a multiple of its alignment (Zero being a valid size +for any alignment). This ensures that an array of that type may always be indexed +by offsetting by a multiple of its size. Note that the size and alignment of a +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: