Skip to content

Commit dc8f93d

Browse files
committed
Rework the syntax specification
For the formal syntax, we had used the existing `GenericParams` production. However, that production isn't exactly appropriate for this case. What's needed here is essentially a generic argument list that only accepts generic parameters as elements. Since none of the other existing productions provide this, we'll define our own. (Thanks to @kennytm for pointing this out.)
1 parent 585458c commit dc8f93d

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

text/3617-precise-capturing.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,18 +171,30 @@ The [syntax for `impl Trait`][] is revised and extended as follows:
171171

172172
[syntax for `impl Trait`]: https://doc.rust-lang.org/nightly/reference/types/impl-trait.html
173173

174-
> _UseCaptures_ :\
175-
>    `use` [_GenericParams_][]
176-
>
177174
> _ImplTraitType_ :
178175
> &nbsp;&nbsp; `impl` _UseCaptures_<sup>?</sup> [_TypeParamBounds_][]
179176
>
180177
> _ImplTraitTypeOneBound_ :
181178
> &nbsp;&nbsp; `impl` _UseCaptures_<sup>?</sup> [_TraitBound_][]
179+
>
180+
> _UseCaptures_ :\
181+
> &nbsp;&nbsp; `use` _UseCapturesGenericArgs_
182+
>
183+
> _UseCapturesGenericArgs_ :\
184+
> &nbsp;&nbsp; &nbsp;&nbsp; `<` `>` \
185+
> &nbsp;&nbsp; | `<` \
186+
> &nbsp;&nbsp; &nbsp;&nbsp; ( _UseCapturesGenericArg_ `,`)<sup>\*</sup> \
187+
> &nbsp;&nbsp; &nbsp;&nbsp; _UseCapturesGenericArg_ `,`<sup>?</sup> \
188+
> &nbsp;&nbsp; &nbsp;&nbsp; `>`
189+
>
190+
> _UseCapturesGenericArg_ :\
191+
> &nbsp;&nbsp; &nbsp;&nbsp; [LIFETIME_OR_LABEL][] \
192+
> &nbsp;&nbsp; | [IDENTIFIER][]
182193
183-
[_GenericParams_]: https://doc.rust-lang.org/nightly/reference/items/generics.html
184-
[_TypeParamBounds_]: https://doc.rust-lang.org/nightly/reference/trait-bounds.html
194+
[IDENTIFIER]: https://doc.rust-lang.org/nightly/reference/identifiers.html
195+
[LIFETIME_OR_LABEL]: https://doc.rust-lang.org/nightly/reference/tokens.html#lifetimes-and-loop-labels
185196
[_TraitBound_]: https://doc.rust-lang.org/nightly/reference/trait-bounds.html
197+
[_TypeParamBounds_]: https://doc.rust-lang.org/nightly/reference/trait-bounds.html
186198

187199
## Reference desugaring
188200

0 commit comments

Comments
 (0)