Skip to content

Commit e4d7e7b

Browse files
committed
Refactor array types to consider the length a const argument
1 parent 1d72212 commit e4d7e7b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/expressions/array-expr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ The array index expression can be implemented for types other than arrays and sl
111111
[IndexMut]: std::ops::IndexMut
112112
[Index]: std::ops::Index
113113
[array]: ../types/array.md
114-
[const argument]: ../items/generics.md
114+
[const argument]: ../items/generics.md#const-generics
115115
[constant item]: ../items/constant-items.md
116116
[literal]: ../tokens.md#literals
117117
[memory location]: ../expressions.md#place-expressions-and-value-expressions

src/types/array.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ r[type.array]
33

44
r[type.array.syntax]
55
```grammar,types
6-
ArrayType -> `[` Type `;` Expression `]`
6+
ArrayType -> `[` Type `;` GenericArgsConst `]`
77
```
88

99
r[type.array.intro]
1010
An array is a fixed-size sequence of `N` elements of type `T`. The array type
1111
is written as `[T; N]`.
1212

1313
r[type.array.constraint]
14-
The size is a [constant expression] that evaluates to a [`usize`].
14+
The size is a [const argument] of type [`usize`].
1515

1616
Examples:
1717

@@ -32,3 +32,4 @@ always bounds-checked in safe methods and operators.
3232
3333
[`usize`]: numeric.md#machine-dependent-integer-types
3434
[constant expression]: ../const_eval.md#constant-expressions
35+
[const argument]: ../items/generics.md##const-generics

0 commit comments

Comments
 (0)