- Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Closed
Copy link
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.Category: This is a bug.T-langRelevant to the language teamRelevant to the language team
Description
The documentation for std::prelude states:
On a technical level, Rust inserts
extern crate std;into the crate root of every crate, and
use std::prelude::v1::*;into every module.
But I believe the second part of that is no longer a correct description of how the prelude works, as far as user-visible behaviour is concerned.
In particular, the following code compiles, but doesn't if I remove the use statement:
mod foo { use std::prelude::v1::*; type Bar = self::String; } And the following doesn't compile (saying «String is ambiguous»), but does if I remove the use for the prelude:
mod foo { use std::prelude::v1::*; use bar::*; mod bar { pub struct String {} } type Baz = String; } (Looking in libsyntax_ext/standard_library_imports.rs, I think it is still literally true that the compiler inserts a fake use directive, but the resolver treats it entirely differently to a normal one, so this doesn't seem to be something it makes sense to document.)
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.Category: This is a bug.T-langRelevant to the language teamRelevant to the language team