# Static rustc_lint::builtin::MISSING_UNSAFE_ON_EXTERN

source ·

    pub static MISSING_UNSAFE_ON_EXTERN: &'static Lint

Expand description

The `missing_unsafe_on_extern` lint detects missing unsafe keyword on extern declarations.

#### §Example

    #![feature(unsafe_extern_blocks)]
    #![warn(missing_unsafe_on_extern)]
    #![allow(dead_code)]

    extern "C" {
        fn foo(_: i32);
    }

    fn main() {}

{{produces}}

#### §Explanation

Declaring extern items, even without ever using them, can cause Undefined Behavior. We should consider all sources of Undefined Behavior to be unsafe.

This is a future-incompatible lint to transition this to a hard error in the future.