Description
The section on methods states this grammar:
Method :
[FunctionQualifiers]fn
[IDENTIFIER] [Generics]?
(
SelfParam (,
[FunctionParam])*,
?)
[FunctionReturnType]? [WhereClause]?
[BlockExpression]SelfParam :
[OuterAttribute]* ( ShorthandSelf | TypedSelf )ShorthandSelf :
(&
|&
[Lifetime])?mut
?self
TypedSelf :
mut
?self
:
[Type]
and then elaborates that [Type] is limited to the following..
P = &'lt S | &'lt mut S | Box<S> | Rc<S> | Arc<S> | Pin<P>
S = Self | P
My thoughts... Why use, the nonterminal, Type in the rule of TypedSelf? It is clear that only a small subset of Type is allowed here. Suggestion...
TypedSelf :
mut
?self
:
[SelfType]
SelfType :
(&
|&
[Lifetime])?mut
? [Self] |Box<
[Self]>
|Rc<
[Self]>
|Arc<
[Self]>
|Pin<
[SelfType]>
Self :
Self
| [SelfType]
then in the example there is this
impl Example {
fn via_projection(self: <Example as Trait>::Output) {}
}
which was not mentioned in the grammar nor is accepted syntax. Should be removed?