Skip to content

Lint against #[no_mangle] with the rust ABI #10347

Closed
@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

#[no_mangle]
fn foo() {}

Should instead be written as:

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

Metadata

Metadata

Assignees

Labels

A-lintArea: New lints

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions