Understanding a Let statement

I am trying to parse a let statement like

let zero = <X as Default>::default();

According to the Rust reference ,
I am not sure if the <X as Default>::default() should be parsed as a QualifiedPathInExpression or a QualifiedPathInType (or something else) ?

By definition, the right side of an "=" in a Let Statement should be an Expression, therefore I suspect this is should be an occurrence of QualifiedPathInExpression

However the call to default() goes against my understanding of the QualifiedPathInExpression definition : its last part is expected to be a PathExprSegment which the default() call is not.

Could any Rust grammarian help clarify how to parse this Let Statement or correct my understanding

default is a PathExprSegment (via the PathIdentSegment rule). The parentheses of the call are part of the CallExpr, not the path.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.