Skip to content

Commit 534e6f5

Browse files
committed
Revise a bit editorially
1 parent c5a48d1 commit 534e6f5

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/expressions/array-expr.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ r[expr.array.array-behavior]
2626
This produces an array containing each of these values in the order they are written.
2727

2828
r[expr.array.repeat]
29-
The syntax for the second form is an expression and a const argument separated by a semicolon (`;`) enclosed in square brackets.
29+
The syntax for the second form is, within square brackets, an expression, then a semicolon (`;`), and finally a [const argument].
3030

3131
r[expr.array.repeat-operand]
3232
The expression before the `;` is called the *repeat operand*.
@@ -35,7 +35,7 @@ r[expr.array.length-operand]
3535
The const argument after the `;` is called the *length operand*.
3636

3737
r[expr.array.length-restriction]
38-
It must be a [const argument] of type `usize`.
38+
The length operand must be a [const argument] of type `usize`.
3939

4040
r[expr.array.repeat-behavior]
4141
An array expression of this form creates an array with the length of the value of the length operand with each element being a copy of the repeat operand.
@@ -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#const-generics
114+
[const argument]: items.generics.const.argument
115115
[constant item]: ../items/constant-items.md
116116
[literal]: ../tokens.md#literals
117117
[memory location]: ../expressions.md#place-expressions-and-value-expressions

src/items/generics.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,12 @@ InferredConst ->
237237
```
238238

239239
r[items.generics.const.inferred.intro]
240-
The inferred const asks the compiler to infer the const argument if possible based on the surrounding information available.
240+
Where a const argument is expected, an `_` (optionally surrounding by any number of matching parentheses), called the "inferred const", can be used instead. This asks the compiler to infer the const argument if possible based on surrounding information.
241241

242242
```rust
243243
fn make_buf() -> [u8; 1024] {
244244
[0x1; _]
245+
// ^ Infers `1024`.
245246
}
246247
```
247248

src/paths.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ GenericArg ->
6262
6363
GenericArgsConst ->
6464
BlockExpression
65+
| InferredConst
6566
| LiteralExpression
6667
| `-` LiteralExpression
6768
| SimplePathSegment
68-
| InferredConst
6969
7070
GenericArgsBinding ->
7171
IDENTIFIER GenericArgs? `=` Type

src/types/array.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +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
35+
[const argument]: items.generics.const.argument

0 commit comments

Comments
 (0)