Description
In Rust 2018 the "crate namespace" now lives outside of the "crate root", yet the reference and the compiler still refer to it as the "crate root". So if you write ::foo::bar
this looks up foo
in the "crate namespace", but the compiler still calls this the "crate root" as can be seen here:
error[E0412]: cannot find type `Bar` in the crate root
--> src/lib.rs:4:16
|
4 | fn ok(_: ::Bar) {}
| ^^^ not found in the crate root
|
help: consider importing this struct
|
4 | use crate::Bar;
|
The help even implies that Bar is indeed in the "crate root".
The reference seems to have a similar problem: https://doc.rust-lang.org/reference/paths.html#path-qualifiers
Paths starting with :: are considered to be global paths where the segments of the path start being resolved from the crate root.
I'm not sure if a proper term for the crate namespace got defined, but it's ambiguous at the moment and causes confusion for beginners: https://twitter.com/mcclure111/status/1368658525891747845