-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-epochWorking group: Epoch (2018) managementWorking group: Epoch (2018) management
Description
This example does not warn, even in Rust 2018 edition:
// compile-flags: --edition 2018
extern crate foo;
fn main() { foo::bar(); }
The reason is that we resolve foo
against the extern crate, when in fact it could also be resolved by the extern prelude fallback. But that's tricky! Something like this could also happen:
// compile-flags: --edition 2018
mod bar { mod foo { } }
use bar::*; // `foo` here is shadowed by `foo` below
extern crate foo;
fn main() { foo::bar(); }
In which case, removing foo
would result in importing the module, since (I believe) that would shadow the implicit prelude imports.
Therefore: we can do better here, but with caution -- for example, we could suggest removing an extern crate in a scenario like this, but only if there are no glob imports in the current module. Not sure it's worth it though.
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-epochWorking group: Epoch (2018) managementWorking group: Epoch (2018) management