Closed
Description
Currently, the #![no_implicit_prelude]
attribute can be used to disable the libstd
prelude imports for a module. However, it seems to disable them for all submodules as well, which makes no sense seeing how the prelude is just a bunch of use
statements, and those don't propagate into child modules.
Example:
fn a() {
let _: Vec<usize> = vec![];
}
mod foo {
#![no_implicit_prelude]
fn b() {
let _: Vec<usize> = vec![];
}
mod bar {
fn c() {
let _: Vec<usize> = vec![];
}
}
}
fn main() {}
... which results in an error for the bar
module as well:
<anon>:9:16: 9:25 error: use of undeclared type name `Vec`
<anon>:9 let _: Vec<usize> = vec![];
^~~~~~~~~
<anon>:14:20: 14:29 error: use of undeclared type name `Vec`
<anon>:14 let _: Vec<usize> = vec![];
^~~~~~~~~
As a fix, #![no_implicit_prelude]
should be changed to only apply to the module it is applied on.