File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,27 @@ fn generic<const B: bool>() {
227
227
}
228
228
```
229
229
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
+ The inferred const asks the compiler to infer the const argument if possible based on the surrounding information available.
241
+
242
+ ``` rust
243
+ fn make_buf () -> [u8 ; 1024 ] {
244
+ [0x1 ; _ ]
245
+ }
246
+ ```
247
+
248
+ r[ items.generics.const.inferred.constraint]
249
+ It cannot be used in item signatures.
250
+
230
251
r[ items.generics.where]
231
252
## Where clauses
232
253
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ GenericArgsConst ->
65
65
| LiteralExpression
66
66
| `-` LiteralExpression
67
67
| SimplePathSegment
68
+ | InferredConst
68
69
69
70
GenericArgsBinding ->
70
71
IDENTIFIER GenericArgs? `=` Type
You can’t perform that action at this time.
0 commit comments