Skip to content

Commit 4299ea5

Browse files
committed
note that usize::MAX arrays -> ZSTs
1 parent 2541604 commit 4299ea5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

reference/src/layout/scalars.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ They have the same layout as the [pointer types] for which the pointee is
4848
> `getelementptr` instruction uses signed-integer field offsets. Rust calls
4949
> `getelementptr` with the `inbounds` flag which assumes that field offsets do
5050
> not overflow,
51+
>
5152
> * the maximum number of elements in an array is `usize::max_value()` (`[T; N:
52-
> usize]`),
53+
> usize]`. Only ZST arrays can probably be this large in practice, non-ZST
54+
> arrays are bound by the maximum size of Rust values,
55+
>
5356
> * the maximum value by which a pointer can be offseted using `ptr.add(count:
5457
> usize)` is `usize::max_value()`.
5558
>

0 commit comments

Comments
 (0)