From 76b80562f130487d1999e17195cbd882c7998762 Mon Sep 17 00:00:00 2001 From: Joshua Liebow-Feeser Date: Wed, 4 Mar 2026 12:04:56 -0500 Subject: [PATCH 1/2] [type layout] usize and isize have the same size and alignment --- src/type-layout.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/type-layout.md b/src/type-layout.md index 28daeef450..753a3174e4 100644 --- a/src/type-layout.md +++ b/src/type-layout.md @@ -44,6 +44,7 @@ The size of most primitives is given in this table. r[layout.primitive.size-int] `usize` and `isize` have a size big enough to contain every address on the target platform. For example, on a 32 bit target, this is 4 bytes, and on a 64 bit target, this is 8 bytes. +`usize` and `isize` have the same size and alignment. r[layout.primitive.align] The alignment of primitives is platform-specific. In most cases, their alignment is equal to their size, but it may be less. In particular, `i128` and `u128` are often aligned to 4 or 8 bytes even though their size is 16, and on many 32-bit platforms, `i64`, `u64`, and `f64` are only aligned to 4 bytes, not 8. From dc2906c61a4b206fb4f44e0ccd20b4dad8f874ee Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 24 Mar 2026 11:57:26 -0700 Subject: [PATCH 2/2] Add a dedicated rule name for the new usize/isize requirement This felt like a sufficiently separate claim that it warrants having its own rule label. This also renames the other one since it was somewhat ambiguous now. --- src/type-layout.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/type-layout.md b/src/type-layout.md index 753a3174e4..fe532c09ee 100644 --- a/src/type-layout.md +++ b/src/type-layout.md @@ -42,8 +42,10 @@ The size of most primitives is given in this table. | `f64` | 8 | | `char` | 4 | -r[layout.primitive.size-int] +r[layout.primitive.size-minimum] `usize` and `isize` have a size big enough to contain every address on the target platform. For example, on a 32 bit target, this is 4 bytes, and on a 64 bit target, this is 8 bytes. + +r[layout.primitive.size-align] `usize` and `isize` have the same size and alignment. r[layout.primitive.align]