rust-lang / rust-lang/reference
Document the issues around calling code in another Rust runtime via the "Rust" ABI
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 607
- PR merge metrics
- PR metrics pending
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Rust Reference pull request discussion and review the existing reference sections on the Rust ABI, runtimes, layout, and unwinding. Resolve which cross-runtime calls and compiler combinations are supported, then document the restrictions and verify that the reference clearly states the relevant safety conditions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100