Usecases, and their requirements


Last modified on 2025-05-26
These results will be followed by a quantitative survey sent around the Rust community.

Negative desire for dynamic linking

Many people have expressed the sentiment that they do not want (more) dynamic linking, and are far happyer with the status quo than they were with dyn linked languages.

Incrementally replace a different language

Usually need to conform to some non-Rust ABI. Specifying the ABI to compile against (rather than mere stability) is desirable. Often, marshalling data is acceptable. Static linking is often sufficient.

Faster compiles

Speed up compile times by not having to do any work on the unchanged crates.

Can also be solved by a smarter compiler and/or bigger computer.

Smaller incremental deployments

Only update the libraries/binaries that changed.

Can also be solved through binary diffing.

Contrast to: next section

Shipping duplicate elements

For example: most things shipped by rustup include large common elements.

The components can be (re-)compiled together, and updated as one through the package manager.

Surface area is relatively small, dyn trait objects are often the main thing being transported.

Having Linux package managers treat us like C/C++ rather than like Go

Doable without any stability, see ArchLinux Haskell packages.

Most package managers (can) rebuild the world every update. The package/crate maintainers can select the crates which should be separate. Cutting a release will include selecting a compiler version, and package versions.

Licensing constraints

Cannot ship some component with the binary, need some guarantee that it won’t be included.

Some people want the opposite, have some crate dependency include some static dependency.

Detailed memory layout

TODO: mention that there is no virtual memory On many embedded systems, the memory is not flat, and the location of bytes is semantically relevant. A program will load its unchanging data (constant data, program text, etc) into execute-in-place flash, and place the rest (globals, the stack, etc) into RAM.

Unfortunately, when putting multiple programs onto the same chip, regular PIC is not sufficient. The read-only and writeable sections need to be relocated independently. LLVM has rwpi and ropi[^Read-Only Position Independence and Read-Write Position Independence], but not at the same time.

On systems without dynamic loading (Hubris), this can be solved by fancy linker scripts and accursed magic. But on systems that want to load programs at runtime (Tock), the OS needs to be able to arbitrarily relocate the two parts of the program. Rust cannot currently output such relocatable objects, as such, all but one Tock program has to be written in C.

Android

For developing Android apps, some desire. Supporting multiple versions of Android, while having access to the new features. Some form of weak linking, only enable some feature if some symbol exists at runtime.

Load libraries as dyn-trait objects

May require unloading when dropping the item. Interaction surface is limited, no globals and such.

Partial updates

Dynamically switch out a module without restarting the process. Would require not just unloading, but also some runtime that can interpose on library calls.

Plugins solved elsewise

Jetbrains uses rpc with separate processes. Zed uses WASM modules.

Linux kernel modules

Unloading needs to be able to be sound, but unsafe is fine. Need to guarantee no use-after-free. Some notion of 'crate would be perfect, or some guarantee that 'static does not leak out of the module.

The module includes the monomorphisations of generic kernel interfaces.

Bevy stuff

Worship at the altar of performance.

Bevy cares mainly about the happy path compile times. It already has its own dependency resolution system and runtime.

For the game: all parts are shipped together, but usually as a packed PE file. For mods: guaranteeing same compiler version is not acceptable.

Need to dyn load vendor-specific libraries, often also require C++ interop

Need to guarantee that LGPL libraries don’t get shipped in the main binary.

Bevy editor

Run two processes, the editor and the game. The editor needs some ABI type information so that it can poke the game.

Either some Rust REPL or some Rust-like scripting language that can poke the same types.

Unloading

  • Changing mods should not require games to restart.
  • UB is acceptable. Bevy already treats 'static as a lie.
  • Leaking memory is acceptable.

Distributed builds

Desire to have cargo/rust generate metadata files before the compilation finishes, so that more builds can be distributed across machines.