Skip to content

Ambiguous import not detected #97584

Closed
Closed
@sander2

Description

@sander2

I tried this code (playground):

use a::*;
mod a {
    pub use b::*;
    mod b {
        pub const SOME_VALUE: u32 = 1;
    }

    pub use c::*;
    mod c {
        pub const SOME_VALUE: u32 = 2;
    }
}
fn main() {
    assert_eq!(SOME_VALUE, 1);
}

I expected to see this happen: an error like error[E0659]: SOME_VALUE is ambiguous

Instead, this happened: the code compiles and runs to completion.

If you put the use a::* after the mod a, the expected error is thrown.

Meta

This happens both on stable and nightly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.P-mediumMedium priorityT-compilerRelevant 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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions