Static rustc_ap_rustc_lint_defs::builtin::UNINHABITED_STATIC[][src]

pub static UNINHABITED_STATIC: &Lint
Expand description

The uninhabited_static lint detects uninhabited statics.

Example

enum Void {}
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.