Skip to content
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

Merged
merged 5 commits into from
Aug 13, 2018

Conversation

joshtriplett
Copy link
Member

@joshtriplett joshtriplett commented Aug 3, 2018

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".

Copy link
Contributor

@Centril Centril left a 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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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);
}
}
```
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

statements -> items

@joshtriplett
Copy link
Member Author

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.

@joshtriplett joshtriplett changed the title path-clarity: Document new relative paths variant path-clarity: Document new uniform paths variant Aug 3, 2018
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.
Copy link
Contributor

@Centril Centril Aug 3, 2018

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".

@Centril
Copy link
Contributor

Centril commented Aug 12, 2018

@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".
@joshtriplett
Copy link
Member Author

@Centril Done.

@Centril
Copy link
Contributor

Centril commented Aug 13, 2018

Neat :) I'll go ahead and merge this. Thanks!

@Centril Centril merged commit 1da7f77 into rust-lang:master Aug 13, 2018
@joshtriplett joshtriplett deleted the relative-paths branch July 1, 2021 19:25
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.

2 participants