mirror of https://github.com/rust-lang/rfcs.git
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.)
This commit is contained in:
parent
585458cc82
commit
dc8f93d315
|
@ -171,18 +171,30 @@ The [syntax for `impl Trait`][] is revised and extended as follows:
|
|||
|
||||
[syntax for `impl Trait`]: https://doc.rust-lang.org/nightly/reference/types/impl-trait.html
|
||||
|
||||
> _UseCaptures_ :\
|
||||
> `use` [_GenericParams_][]
|
||||
>
|
||||
> _ImplTraitType_ :
|
||||
> `impl` _UseCaptures_<sup>?</sup> [_TypeParamBounds_][]
|
||||
>
|
||||
> _ImplTraitTypeOneBound_ :
|
||||
> `impl` _UseCaptures_<sup>?</sup> [_TraitBound_][]
|
||||
>
|
||||
> _UseCaptures_ :\
|
||||
> `use` _UseCapturesGenericArgs_
|
||||
>
|
||||
> _UseCapturesGenericArgs_ :\
|
||||
> `<` `>` \
|
||||
> | `<` \
|
||||
> ( _UseCapturesGenericArg_ `,`)<sup>\*</sup> \
|
||||
> _UseCapturesGenericArg_ `,`<sup>?</sup> \
|
||||
> `>`
|
||||
>
|
||||
> _UseCapturesGenericArg_ :\
|
||||
> [LIFETIME_OR_LABEL][] \
|
||||
> | [IDENTIFIER][]
|
||||
|
||||
[_GenericParams_]: https://doc.rust-lang.org/nightly/reference/items/generics.html
|
||||
[_TypeParamBounds_]: https://doc.rust-lang.org/nightly/reference/trait-bounds.html
|
||||
[IDENTIFIER]: https://doc.rust-lang.org/nightly/reference/identifiers.html
|
||||
[LIFETIME_OR_LABEL]: https://doc.rust-lang.org/nightly/reference/tokens.html#lifetimes-and-loop-labels
|
||||
[_TraitBound_]: https://doc.rust-lang.org/nightly/reference/trait-bounds.html
|
||||
[_TypeParamBounds_]: https://doc.rust-lang.org/nightly/reference/trait-bounds.html
|
||||
|
||||
## Reference desugaring
|
||||
|
||||
|
|
Loading…
Reference in New Issue