Skip to content

Commit 9fbce80

Browse files
committed
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.)
1 parent 26911c8 commit 9fbce80

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

text/3617-precise-capturing.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,15 @@ The `use<..>` specifier applies to the entire `impl Trait` opaque type. In cont
162162
fn foo<T>(_: T) -> impl use<T> for<'a> FnOnce(&'a ()) { |&()| () }
163163
```
164164

165+
## Optional trailing comma
166+
167+
As with other lists of generic arguments in Rust, a trailing comma is optional in `use<..>` specifiers:
168+
169+
```rust
170+
fn foo1<T>(_: T) -> impl use<T> Sized {} //~ OK.
171+
fn foo2<T>(_: T) -> impl use<T,> Sized {} //~ Also OK.
172+
```
173+
165174
# Reference-level explanation
166175
[reference-level-explanation]: #reference-level-explanation
167176

0 commit comments

Comments
 (0)