Skip to content

Document inferred const args (feature(generic_arg_infer)) #1835

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/items/generics.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,22 @@ fn generic<const B: bool>() {
}
```

r[items.generics.const.inferred]

r[items.generics.const.inferred.syntax]
```grammar,const
InferredConst ->
`_`
| `(` InferredConst `)`
```

r[items.generics.const.inferred.intro]
The inferred const asks the compiler to infer the const argument if possible
based on the surrounding information available.

r[items.generics.const.inferred.constraint]
It cannot be used in item signatures.

r[items.generics.where]
## Where clauses

Expand Down