HIDDEN_GLOB_REEXPORTS in rustc_lint_defs::builtin - Rust
Description: The `hidden_glob_reexports` lint detects cases where glob re-export items are shadowed by private items.

Skip to main content

## HIDDEN_GLOB_REEXPORTS

# Static 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.