-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Ambiguous terminology "crate root" #82876
Comments
The reference is referring to Rust 2015 and needs to be updated. I don't think we need a name for it, but rather we can specify that when you use |
Actually, it's called the "extern prelude" but nobody uses that term. The reference mentions this. |
Twitter kind of makes it unclear exactly what Cryze is linking there so to be clear: the thing that confused me, as a newbie, reading the reference is in 2.7 of the reference, it says:
Until this was explained to me, it sounded to me like these two quotes were designing the same concept. The point of confusion for me was that "the crate root" could ambiguously be read as "the root of all crates" or "the root of the crate". I was reading the reference and maybe it is expected a reader of the reference realizes "the crate root" means something specific and special, but it did trip me up. |
Yeah the "crate root" means a specific thing, whereas |
I have patches for this, just need to update test expectations |
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 upfoo
in the "crate namespace", but the compiler still calls this the "crate root" as can be seen here: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
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
The text was updated successfully, but these errors were encountered: