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>() {
227227}
228228```
229229
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+
230251r[ items.generics.where]
231252## Where clauses
232253
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ GenericArgsConst ->
6565 | LiteralExpression
6666 | `-` LiteralExpression
6767 | SimplePathSegment
68+ | InferredConst
6869
6970GenericArgsBinding ->
7071 IDENTIFIER GenericArgs? `=` Type
You can’t perform that action at this time.
0 commit comments