Skip to content

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

Merged
merged 6 commits into from
Oct 6, 2018
Merged

Grammar: Paths #431

merged 6 commits into from
Oct 6, 2018

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Sep 23, 2018

This includes a variety of things all related to paths:

  • Paths
  • Path expressions
  • Method call expression
  • Attribute clarifications
  • Visibility fixes

Copy link
Contributor

@matthewjasper matthewjasper left a 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
> &nbsp;&nbsp; `::`<sup>?</sup> _TypePathSegment_ (`::` _TypePathSegment_)<sup>\*</sup>
>
> _TypePathSegment_ :\
> &nbsp;&nbsp; _PathIdentSegment_ (`::`<sup>?</sup> [_Generics_])<sup>?</sup>
Copy link
Contributor

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.

Copy link
Contributor Author

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)?

Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

@matthewjasper matthewjasper left a 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.

> &nbsp;&nbsp; | IDENTIFIER `(` _MetaSeq_ `)`
> &nbsp;&nbsp; &nbsp;&nbsp; [_SimplePath_]\
> &nbsp;&nbsp; | [_SimplePath_] `=` [_LiteralExpression_]<sub>_without suffix_</sub>\
> &nbsp;&nbsp; | [_SimplePath_] `(` _MetaSeq_ `)`
>
> _MetaSeq_ :\
> &nbsp;&nbsp; &nbsp;&nbsp; EMPTY\
> &nbsp;&nbsp; | _MetaItem_\
Copy link
Contributor

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?

@@ -460,4 +460,4 @@ assert_eq!(x, 14);
[_CompoundAssignmentExpression_]: #compound-assignment-expressions

[_Expression_]: expressions.html
[_PathInExpression_]: paths.html
[_PathInExpression_]: paths.html#paths-in-expressions
Copy link
Contributor

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
> &nbsp;&nbsp; `::`<sup>?</sup> _SimplePathSegment_ (`::` _SimplePathSegment_)<sup>\*</sup>
>
> _SimplePathSegment_ :\
> &nbsp;&nbsp; [IDENTIFIER] | `super` | `self` | `$crate`
Copy link
Contributor

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_ :\
> &nbsp;&nbsp; _QualifiedPathType_ (`::` _PathExprSegment_)<sup>\*</sup>
Copy link
Contributor

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 *?

@ehuss
Copy link
Contributor Author

ehuss commented Oct 1, 2018

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.

@Havvy
Copy link
Contributor

Havvy commented Oct 1, 2018

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.

@ehuss
Copy link
Contributor Author

ehuss commented Oct 2, 2018

There are four blockquotes that say "Edition Differences".

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 extern crate changes, as I'd like that in a separate PR. I waffled back and forth on the details and wording, I have no idea if it's clear at all.

@matthewjasper matthewjasper merged commit 49d6c3c into rust-lang:master Oct 6, 2018
@matthewjasper
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants