-
Notifications
You must be signed in to change notification settings - Fork 532
Grammar: Paths #431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grammar: Paths #431
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this. A few things that I noticed when looking through this.
src/paths.md
Outdated
> `::`<sup>?</sup> _TypePathSegment_ (`::` _TypePathSegment_)<sup>\*</sup> | ||
> | ||
> _TypePathSegment_ :\ | ||
> _PathIdentSegment_ (`::`<sup>?</sup> [_Generics_])<sup>?</sup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also a variant that allows specifying associated items (i.e. Iterator<Item=i32>
). I'm not sure if having two variants here is better or worse that specifying when it's allow in the prose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I'm following. Is that form not part of the generics (TypeParam in generics)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I must have missed that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized I had the wrong rule listed, updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had another read through. Left some comments, although some are not for changes from this PR.
src/attributes.md
Outdated
> | IDENTIFIER `(` _MetaSeq_ `)` | ||
> [_SimplePath_]\ | ||
> | [_SimplePath_] `=` [_LiteralExpression_]<sub>_without suffix_</sub>\ | ||
> | [_SimplePath_] `(` _MetaSeq_ `)` | ||
> | ||
> _MetaSeq_ :\ | ||
> EMPTY\ | ||
> | _MetaItem_\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're here, could you add an optional trailing comma?
src/expressions/operator-expr.md
Outdated
@@ -460,4 +460,4 @@ assert_eq!(x, 14); | |||
[_CompoundAssignmentExpression_]: #compound-assignment-expressions | |||
|
|||
[_Expression_]: expressions.html | |||
[_PathInExpression_]: paths.html | |||
[_PathInExpression_]: paths.html#paths-in-expressions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not from your PR, but this should be changed to _Type_
and link to types.html
src/paths.md
Outdated
> `::`<sup>?</sup> _SimplePathSegment_ (`::` _SimplePathSegment_)<sup>\*</sup> | ||
> | ||
> _SimplePathSegment_ :\ | ||
> [IDENTIFIER] | `super` | `self` | `$crate` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add crate
here (and for PathIdentSegment, Path qualifiers and Canonical paths).
src/paths.md
Outdated
identifier in the path must resolve to an item. | ||
> **<sup>Syntax</sup>**\ | ||
> _QualifiedPathInExpression_ :\ | ||
> _QualifiedPathType_ (`::` _PathExprSegment_)<sup>\*</sup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be +
instead of *
?
I didn't document any of the 2018 behavior, but I guess the current nightly should in theory be the first stable release of 2018, so I'll add that soon. For some reason I was thinking there was another release in-between, time flies! AFAIK, the reference currently doesn't have any 2018 documentation. I'll need to spend some time to try to figure out a clear way to show the differences. #281 mentioned using boxes, but I'm not sure if that really fits (should the box document the new behavior or the old?). I'll experiment a little. |
There are four blockquotes that say "Edition Differences". They're mainly like that because no thought has been put into it. If you can think of a better way, feel free to change them to that. |
This includes a variety of things all related to paths: - Paths - Path expressions - Method call expression - Attribute clarifications - Visibility fixes
Ah, my branches were out of date so I didn't see that. I've updated with some information about 2018 paths. I explicitly skipped over the |
Thanks! |
This includes a variety of things all related to paths: