Static rustc_lint_defs::builtin::HIDDEN_GLOB_REEXPORTS

source ·
pub static HIDDEN_GLOB_REEXPORTS: &Lint
Expand description

The hidden_glob_reexports lint detects cases where glob re-export items are shadowed by private items.

§Example

#![deny(hidden_glob_reexports)]

pub mod upstream {
    mod inner { pub struct Foo {}; pub struct Bar {}; }
    pub use self::inner::*;
    struct Foo {} // private item shadows `inner::Foo`
}

// mod downstream {
//     fn test() {
//         let _ = crate::upstream::Foo; // inaccessible
//     }
// }

pub fn main() {}

{{produces}}

§Explanation

This was previously accepted without any errors or warnings but it could silently break a crate’s downstream user code. If the struct Foo was added, dep::inner::Foo would silently become inaccessible and trigger a “struct Foo is private” visibility error at the downstream use site.