The systemd project has merged support for writing components in Rust alongside C. Its maintainers say Rust is acceptable for individual binaries but not yet for core shared code.

systemd has merged support for Rust, so its components can now be written in Rust as well as C. Adding a second core language to a large, established project is always contentious, but the maintainers have decided that Rust is acceptable for leaf components, meaning individual binaries. Using Rust in the core shared library, libsystemd-shared.so, is not acceptable yet. That would require first-class shared library support in Rust, a long-standing problem often called the stable ABI problem. Static linking is also ruled out, since systemd is split into more than 180 binaries.
The shared code will stay in C and be wrapped as Rust crates for Rust binaries. The project has set several principles. Core APIs, such as the chase*() path lookup functions, should be used uniformly. Rust and C binaries must parse options, show help, and report errors in the same way. Meson remains the only build system, with no reliance on cargo. Dependencies stay tightly controlled: systemd links only against libc and loads other libraries through dlopen(). It also avoids the Rust standard library and provides its own allocator crate, because failed allocations in Rust cause panics.
Existing C code will not be rewritten without a good reason, and Rust remains optional, so systemd without Rust stays fully supported. The maintainers also praised the Rust community for quickly reverting a change in Rust 1.100 that would have broken the new support. They said they hope adopting Rust in leaf binaries will signal to the Rust community that core Linux components are moving toward it.
Source: Amutable







