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

Clarify that ::foo paths are not necessarily based off of the "crate root" #974

Merged
merged 3 commits into from
Mar 9, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,17 @@ how it is resolved.

### `::`

Paths starting with `::` are considered to be global paths where the segments of the path
start being resolved from the crate root. Each identifier in the path must resolve to an
item.

> **Edition Differences**: In the 2015 Edition, the crate root contains a variety of
> different items, including external crates, default crates such as `std` or `core`, and
> items in the top level of the crate (including `use` imports).
Paths starting with `::` are considered to be "global paths" where the segments of the path
Manishearth marked this conversation as resolved.
Show resolved Hide resolved
start being resolved from a place which differs based on edition. Each identifier in
the path must resolve to an item.

> **Edition Differences**: In the 2015 Edition, identifiers resolve from the "crate root"
> (`crate::` in the 2018 edition), which contains a variety of different items, including
> external crates, default crates such as `std` or `core`, and items in the top level of
> the crate (including `use` imports).
>
> Beginning with the 2018 Edition, paths starting with `::` can only reference
> crates in the [extern prelude].
> Beginning with the 2018 Edition, paths starting with `::` resolve from
> crates in the [extern prelude], i.e. they _must_ be followed by the name of a crate.
Manishearth marked this conversation as resolved.
Show resolved Hide resolved

```rust
mod a {
Expand Down