PRIVATE_INTERFACES in rustc_lint::builtin - Rust
Description: The `private_interfaces` lint detects types in a primary interface of an item, that are more private than the item itself. Primary interface of an item is all its interface except for bounds on generic parameters and where clauses.

Skip to main content

## PRIVATE_INTERFACES

# Static PRIVATE_INTERFACES

Source

    pub static PRIVATE_INTERFACES: &'static Lint

Expand description

The `private_interfaces` lint detects types in a primary interface of an item, that are more private than the item itself. Primary interface of an item is all its interface except for bounds on generic parameters and where clauses.

#### §Example

ⓘ

    #![deny(private_interfaces)]
    struct SemiPriv;

    mod m1 {
        struct Priv;
        impl crate::SemiPriv {
            pub fn f(_: Priv) {}
        }
    }

{{produces}}

#### §Explanation

Having something private in primary interface guarantees that the item will be unusable from outer modules due to type privacy.