Skip to content

Commit

Permalink
Clarify that ::foo paths are not necessarily based off of the "crate …
Browse files Browse the repository at this point in the history
…root"
  • Loading branch information
Manishearth committed Mar 7, 2021
1 parent 3b6fe80 commit 76e233c
Showing 1 changed file with 10 additions and 9 deletions.
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
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 from
> crates in the [extern prelude], i.e. they _must_ be followed by the name of a crate.
```rust
mod a {
Expand Down

0 comments on commit 76e233c

Please sign in to comment.