-
Couldn't load subscription status.
- Fork 13.9k
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.)