mirror of https://github.com/rust-lang/rfcs.git
Add guide-level section on the trailing comma
As with other lists of generic arguments in Rust, the grammar for `use<..>` specifiers supports an optional trailing comma. This is already specified in the formal grammar, but let's also note this in the guide-level section. (Thanks to Josh Triplett for raising this point.)
This commit is contained in:
parent
26911c8b30
commit
9fbce80d84
|
@ -162,6 +162,15 @@ The `use<..>` specifier applies to the entire `impl Trait` opaque type. In cont
|
|||
fn foo<T>(_: T) -> impl use<T> for<'a> FnOnce(&'a ()) { |&()| () }
|
||||
```
|
||||
|
||||
## Optional trailing comma
|
||||
|
||||
As with other lists of generic arguments in Rust, a trailing comma is optional in `use<..>` specifiers:
|
||||
|
||||
```rust
|
||||
fn foo1<T>(_: T) -> impl use<T> Sized {} //~ OK.
|
||||
fn foo2<T>(_: T) -> impl use<T,> Sized {} //~ Also OK.
|
||||
```
|
||||
|
||||
# Reference-level explanation
|
||||
[reference-level-explanation]: #reference-level-explanation
|
||||
|
||||
|
|
Loading…
Reference in New Issue