LINKER_MESSAGES in rustc_lint::builtin - Rust
Description: The `linker_messages` lint forwards warnings from the linker.

Skip to main content

## LINKER_MESSAGES

# Static LINKER_MESSAGES

Source

    pub static LINKER_MESSAGES: &'static Lint

Expand description

The `linker_messages` lint forwards warnings from the linker.

#### §Example

ⓘ

    #[warn(linker_messages)]
    extern "C" {
      fn foo();
    }
    fn main () { unsafe { foo(); } }

On Linux, using `gcc -Wl,--warn-unresolved-symbols` as a linker, this will produce

    warning: linker stderr: rust-lld: undefined symbol: foo
             >>> referenced by rust_out.69edbd30df4ae57d-cgu.0
             >>>               rust_out.rust_out.69edbd30df4ae57d-cgu.0.rcgu.o:(rust_out::main::h3a90094b06757803)
      |
    note: the lint level is defined here
     --> warn.rs:1:9
      |
    1 | #![warn(linker_messages)]
      |         ^^^^^^^^^^^^^^^
    warning: 1 warning emitted

#### §Explanation

Linkers emit platform-specific and program-specific warnings that cannot be predicted in advance by the Rust compiler. Such messages are ignored by default for now. While linker warnings could be very useful they have been ignored for many years by essentially all users, so we need to do a bit more work than just surfacing their text to produce a clear and actionable warning of similar quality to our other diagnostics. See this tracking issue for more details: https://github.com/rust-lang/rust/issues/136096.