From a333dec6c4a722102be24135081fdefbad514dae Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Tue, 29 Jul 2025 14:51:26 +0000 Subject: [PATCH] Clarify layout of tuples when last field is unsized --- src/type-layout.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/type-layout.md b/src/type-layout.md index 425f82d5c..026db246c 100644 --- a/src/type-layout.md +++ b/src/type-layout.md @@ -121,6 +121,9 @@ r[layout.tuple.unit] The exception to this is the unit tuple (`()`), which is guaranteed as a zero-sized type to have a size of 0 and an alignment of 1. +> [!NOTE] +> It is not guaranteed that the last field of a tuple is stored at the end. For example, this means that `(i32, [u8; 10])` and `(i32; [u8])` might *not* have compatible layouts. + r[layout.trait-object] ## Trait Object Layout