-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-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.P-mediumMedium priorityMedium priorityT-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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
User mattscode
from irc reported that the following code compiles, and seems to pick a favourite between identical names. We agree we expect this to be a compile error:
fn main() {
use a::*;
x();
// a::x(); // This fails to compile due to an ambiguous x
}
mod a {
mod b {
pub fn x() { println!(module_path!()); }
}
mod c {
pub fn x() { println!(module_path!()); }
}
pub use self::b::*;
pub use self::c::*;
}
It compiles, and when run it outputs:
playground::a::b
Note that x()
is not an error and picks b::x
as the preferred x
. Calling a::x()
is an ambiguity error, as expected.
This bug exists in at least:
- rustc 1.23.0
- rustc 1.25.0-nightly (da569fa 2018-01-16)
Metadata
Metadata
Assignees
Labels
A-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.P-mediumMedium priorityMedium priorityT-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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.