You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
If you pass a type across the extern "Rust" boundary, both sides need to use the exact same rmeta/rlib/dylib for the type definition. If you do, then the -Zrandomize-layout for the type also matches.
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 thenrepr(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
The text was updated successfully, but these errors were encountered: