Skip to content

Commit 3b5a851

Browse files
authored
Merge pull request rust-lang#162 from gnzlbg/zero_sized_arrays
Spell out when arrays have zero size
2 parents 401e559 + 6d17f76 commit 3b5a851

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

reference/src/layout/arrays-and-slices.md

+6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ The _stride_ of the array is constant for all element pairs and it is computed
2525
as the _size_ of the element type rounded up to the next multiple of the
2626
_alignment_ of the element type.
2727

28+
### Arrays of zero-size
29+
30+
Arrays `[T; N]` have zero size if and only if their count `N` is zero or their
31+
element type `T` is zero-sized.
32+
2833
### Special case `stride == size`
2934

3035
When the element _size_ is a multiple of the element's _alignment_, then `stride
@@ -42,6 +47,7 @@ pointer to the first element of the array by `i`[^1].
4247

4348
[layout of structs and tuples]: ./structs-and-tuples.md
4449

50+
4551
### Layout compatibility with packed SIMD vectors
4652

4753
The [layout of packed SIMD vector types][Vector] [^2] requires the _size_ and

0 commit comments

Comments
 (0)