Static rustc_lint_defs::builtin::UNNAMEABLE_TYPES

source ·
pub static UNNAMEABLE_TYPES: &Lint
Expand description

The unnameable_types lint detects types for which you can get objects of that type, but cannot name the type itself.


mod m {
    pub struct S;

pub fn get_unnameable() -> m::S { m::S }



It is often expected that if you can obtain an object of type T, then you can name the type T as well, this lint attempts to enforce this rule. The recommended action is to either reexport the type properly to make it nameable, or document that users are not supposed to be able to name it for one reason or another.

Besides types, this lint applies to traits because traits can also leak through signatures, and you may obtain objects of their dyn Trait or impl Trait types.