Skip to content

Commit b5f6be8

Browse files
committed
Dont add new grammar rules
1 parent 007ac0f commit b5f6be8

File tree

2 files changed

+13
-23
lines changed

2 files changed

+13
-23
lines changed

src/items/generics.md

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,19 @@ fn example() {
171171
}
172172
```
173173

174+
r[items.generics.const.inferred]
175+
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.
176+
177+
```rust
178+
fn make_buf() -> [u8; 1024] {
179+
[0x1; _]
180+
// ^ Infers `1024`.
181+
}
182+
```
183+
184+
r[items.generics.const.inferred.constraint]
185+
It cannot be used in item signatures.
186+
174187
r[items.generics.const.type-ambiguity]
175188
When there is ambiguity if a generic argument could be resolved as either a
176189
type or const argument, it is always resolved as a type. Placing the argument
@@ -227,28 +240,6 @@ fn generic<const B: bool>() {
227240
}
228241
```
229242

230-
r[items.generics.const.inferred]
231-
232-
r[items.generics.const.inferred.syntax]
233-
```grammar,items
234-
InferredConst ->
235-
`_`
236-
| `(` InferredConst `)`
237-
```
238-
239-
r[items.generics.const.inferred.intro]
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.
241-
242-
```rust
243-
fn make_buf() -> [u8; 1024] {
244-
[0x1; _]
245-
// ^ Infers `1024`.
246-
}
247-
```
248-
249-
r[items.generics.const.inferred.constraint]
250-
It cannot be used in item signatures.
251-
252243
r[items.generics.where]
253244
## Where clauses
254245

src/paths.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ GenericArgsConst ->
6565
| LiteralExpression
6666
| `-` LiteralExpression
6767
| SimplePathSegment
68-
| InferredConst
6968
7069
GenericArgsBinding ->
7170
IDENTIFIER GenericArgs? `=` Type

0 commit comments

Comments
 (0)