Lint against #[no_mangle] with the rust ABI · Issue #10347 · rust-lang/rust-clippy (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@bjorn3

Description

@bjorn3

What it does

The lint should lint against #[no_mangle] on functions with the rust abi. See Rust-for-Linux/linux#967 for an example of this kind of issue.

Lint Name

no_mangle_with_rust_abi

Category

No response

Advantage

The Rust ABI is not stable, but in many simple cases matches enough with the C ABI that it is possible to forget to add extern "C" to a function called from C. Changes to the Rust ABI can break this at any point.

Drawbacks

No response

Example

Should instead be written as:

#[no_mangle] extern "C" fn foo() {}