Skip to main content

AMBIGUOUS_IMPORT_VISIBILITIES

Static AMBIGUOUS_IMPORT_VISIBILITIES 

Source
pub static AMBIGUOUS_IMPORT_VISIBILITIES: &'static Lint
Expand description

The ambiguous_import_visibilities lint detects imports that should report ambiguity errors, but previously didn’t do that due to rustc bugs.

§Example

#![deny(unknown_lints)]
#![deny(ambiguous_import_visibilities)]
mod reexport {
    mod m {
        pub struct S {}
    }

    macro_rules! mac {
        () => { use m::S; }
    }

    pub use m::*;
    mac!();

    pub use S as Z; // ambiguous visibility
}

fn main() {
    reexport::Z {};
}

{{produces}}

§Explanation

Previous versions of Rust compile it successfully because it fetched the glob import’s visibility for pub use S as Z import, and ignored the private use m::S import that appeared later.

This is a future-incompatible lint to transition this to a hard error in the future.