[−][src]Static rustc_lint::builtin::UNREACHABLE_PUB

pub static UNREACHABLE_PUB: &Lint

The unreachable_pub lint triggers for pub items not reachable from the crate root.

Example

ⓘThis example deliberately fails to compile
#![deny(unreachable_pub)]
mod foo {
    pub mod bar {

    }
}

{{produces}}

Explanation

A bare pub visibility may be misleading if the item is not actually publicly exported from the crate. The pub(crate) visibility is recommended to be used instead, which more clearly expresses the intent that the item is only visible within its own crate.

This lint is "allow" by default because it will trigger for a large amount existing Rust code, and has some false-positives. Eventually it is desired for this to become warn-by-default.