Skip to content

Rust allows mismatching function declarations and definitions #58

@teor2345

Description

@teor2345

Currently, the Rust compiler allows an exported extern function declaration and its function definition to have different argument counts or incompatible arguments.

This can cause unsound behaviour if the ABI is incompatible, or it is compatible, but the types are mismatched.

There is a discussion about detecting ABI incompatibilities, and linting when the ABI is compatible but the declaration is likely a mistake:
https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/Lint.20for.20comparing.20Rust.20signatures.20with.20C.20header.20files/near/590539789

Metadata

Metadata

Assignees

No one assigned

    Labels

    l-rustChanges that are mainly in Rustp-ergonomicsProblems that make interop harder to usep-safetySafety or soundness related problems or use casest-problem-statementA description of an interop problem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions