Skip to content

Document the issues around calling code in another Rust runtime via the "Rust" ABI #1642

@RalfJung

Description

@RalfJung

We do permit having more than one copy of the Rust runtime inside a binary, and AFAIK we also permit "Rust" ABI function calls between code using different runtimes, as long as they were built with the exact same toolchain. Or do we require the boundary to entirely consist of stable ABIs such as "C"? Either way, we should document this in the reference. There are probably restrictions on which code can be combined, e.g. if -Zrandomize-layout is set on either side then repr(Rust) types may end up having different layout. And there are definitely restrictions around -Cpanic=abort, since that flag makes the compiler assume that a "Rust" call can never unwind, which means it is UB to make a "Rust" call into another Rust runtime that does unwind.

This came up here but got moved to an issue.

Cc @rust-lang/opsem

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions