-
Notifications
You must be signed in to change notification settings - Fork 113
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
path-clarity: Document new uniform paths variant #74
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.
Looks good in general but I have some nits.
Note: During the 2018 edition preview, there are two variants of the module | ||
system under consideration, the "absolute use paths" variant and the "relative | ||
paths" variant. Most of these changes apply to both variants; the two variant | ||
sections call out the differences between the two. We would encourage testing |
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.
s/we would encourage/we encourage
* Absolute paths begin with a crate name, where the keyword `crate` | ||
refers to the current crate. | ||
* The `crate` keyword refers to the current crate. | ||
* Relative paths variant: Paths work uniformly in both `use` statements and in |
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 think use
should be referred to as an item and not a statement, https://doc.rust-lang.org/reference/items/use-declarations.html
### Absolute paths begin with `crate` or the crate name | ||
### The `crate` keyword refers to the current crate. | ||
|
||
In `use` statements and in other code, you can refer to the root of the current |
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.
statement -> istem
### Relative paths variant | ||
|
||
The relative paths variant of Rust 2018 simplifies and unifies path handling | ||
compared to Rust 2015. In Rust 2015, paths work differently in use statements |
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.
statements -> items
|
||
The relative paths variant of Rust 2018 simplifies and unifies path handling | ||
compared to Rust 2015. In Rust 2015, paths work differently in use statements | ||
than they do elsewhere. In particular, paths in `use` statements would always |
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.
statements -> items
module, which meant that everything would seem straightforward until working on | ||
a project large enough to have submodules. | ||
|
||
In the relative paths variant of Rust 2018, paths in `use` statements and in |
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.
statements -> items
let five = std::sync::Arc::new(5); | ||
} | ||
} | ||
``` |
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.
An example with enums would be beneficial here to illustrate self::
|
||
### Absolute use paths variant | ||
|
||
In the absolute use paths variant of Rust 2018, paths in `use` statements |
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.
statements -> items
41e7074
to
d074c9d
Compare
Note that this should not get merged until some version of rust-lang/rust#52923 gets merged. We also need to document how to test the two different variants. |
883030c
to
159bf86
Compare
paths" variant. Most of these changes apply to both variants; the two variant | ||
sections call out the differences between the two. We encourage testing of the | ||
new "relative paths" variant introduced in edition preview 2. The release of | ||
new "uniform paths" variant introduced in edition preview 2. The release of | ||
the 2018 edition will use one of these two variants. |
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.
Perhaps: "Once the Rust 2018 is released, only one of these two variants will be stabilized and available".
@joshtriplett can you rebase this one? :) |
For the final Rust 2018 release, we can delete the section that doesn't apply, and change the various qualified references like "the relative paths variant of Rust 2018" to just "Rust 2018".
…solute" Describe the new variant as "uniform paths", and the previous variant as "anchored use paths". These names both highlight the primary benefit of each variant, and avoid describing paths including "self" or "super" as "absolute".
f14eee9
to
42654b6
Compare
@Centril Done. |
Neat :) I'll go ahead and merge this. Thanks! |
For the final Rust 2018 release, we can delete the section that doesn't
apply, and change the various qualified references like "the uniform
paths variant of Rust 2018" to just "Rust 2018".