Skip to content

Commit 23b9af8

Browse files
Grammar nit wrt ? and async
1 parent febff99 commit 23b9af8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

text/3668-async-closure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ This RFC specifies the modification to the _TraitBound_ nonterminal in the gramm
255255
256256
**note**: The grammar specifies that any `for<'a>` higher-ranked lifetimes come *after* the `?` trait polarity. This seems inconsistent, but should be changed independently from this RFC. There's an open question about how to deal with the ordering problem of `?`, `for<'a>`, and `async`, or we want to separate `async` traits into their own production rule.
257257

258-
Since the grammar doesn't distinguish parenthesized and angle-bracketed generics in `_TypePath_`, `async` as a trait bound modifier will be **accepted** in all trait bounds at _parsing_ time, but it will be **denied** by the compiler _post-expansion_ if it's not attached to a parenthesized `Fn()` trait bound.
258+
Since the grammar doesn't distinguish parenthesized and angle-bracketed generics in `_TypePath_`, `async` as a trait bound modifier will be **accepted** in all trait bounds at _parsing_ time, but it will be **rejected** by the compiler _post-expansion_ if it's not attached to a parenthesized `Fn()` trait bound. Similarly, the combination of `async` and `?` is syntactically valid but semantically invalid, and will be rejected by the compiler post-expansion.
259259

260260
Users are able to write `async Fn*() -> T` trait bounds in all positions that trait bounds are allowed, for example:
261261

0 commit comments

Comments
 (0)