-
Notifications
You must be signed in to change notification settings - Fork 487
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
Document uniform_paths
#697
Conversation
Ie, state that "use" statements can start with an identifier, resolved in a similar way to a path expression. Now the main text and example in use-declarations.md describe the 2018 edition semantics, and the "Edition Differences" section says how the 2015 edition differs.
src/items/use-declarations.md
Outdated
module. `::` can be used to explicitly refer to a crate, requiring an extern | ||
crate name to follow. | ||
Paths in `use` items must start with an identifier or one of the [path | ||
qualifiers] `crate`, `self`, `super`, or `::`. |
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.
This is not specific to use
paths and is true for all paths.
src/items/use-declarations.md
Outdated
<!-- Note: This example works as-is in either 2015 or 2018. --> | ||
`crate` refers to the current crate. `self` refers to the current module. | ||
`super` refers to the parent module. `::` refers to the [extern prelude] (so | ||
it requires a crate name to follow). |
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.
This is not specific to use
paths and is true for all paths.
Also, what edition is documented? The ::
bit is not true for 2015 edition.
src/items/use-declarations.md
Outdated
|
||
```rust | ||
If the path starts with an identifier, the identifier is resolved in the same | ||
way as for a path in an expression (in particular, it can be a crate name or |
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.
"Expression" here is a bit too specific, this is true for any non-import path.
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.
If the path starts with an identifier
And if the path doesn't start with an identifier, the behavior is also the same.
The text leaves the non-identifier case up in the air though and never talks about it below.
Now the main text describes what is true in both 2015 and 2018 editions; the varying behaviour (and all examples) are in an "Edition differences" section. For the behaviour which doesn't vary between editions, avoids repeating resolution rules which are documented elsewhere.
I've pushed a new proposed version of the text. I've reduced the text which describes resolution behaviour which isn't specific to I've made it more explicit about which pieces of text describe which editions. |
Closing: #1052 covers this properly |
This updates use-declarations.md to describe the uniform_paths behaviour (requested in #487).
It also reorders things so that the main text and example describe the 2018 edition semantics, and the "Edition Differences" section says how the 2015 edition differs.
See also #291 "Path and module changes".