UNINHABITED_STATIC in rustc_lint::builtin - Rust
Description: The `uninhabited_static` lint detects uninhabited statics.

Skip to main content

## UNINHABITED_STATIC

# Static UNINHABITED_STATIC

Source

    pub static UNINHABITED_STATIC: &'static Lint

Expand description

The `uninhabited_static` lint detects uninhabited statics.

#### §Example

ⓘ

    enum Void {}
    unsafe extern {
        static EXTERN: Void;
    }

{{produces}}

#### §Explanation

Statics with an uninhabited type can never be initialized, so they are impossible to define. However, this can be side-stepped with an `extern static`, leading to problems later in the compiler which assumes that there are no initialized uninhabited places (such as locals or statics). This was accidentally allowed, but is being phased out.