Eurydice is a compiler developed within the Aeneas project that translates Rust source code into C code intended to be human-readable and suitable for environments where verification tools expect C but a Rust toolchain is unavailable. Originating from a collaboration between Inria and Microsoft, the project aims to provide a stopgap measure as the verification ecosystem gradually adopts Rust, allowing new Rust programs to be used in legacy settings that still rely on C-based analysis.
The compiler works by first employing the Charon tool to extract Rust's medium-level intermediate representation (MIR) as JSON from rustc, then converting that MIR into KaRaMeL's internal abstract syntax tree. Over thirty nano‑passes operate on this AST to eliminate Rust‑specific constructs that lack direct C equivalents while preserving the original program’s evaluation order and structure; for instance, a simple recursive GCD function is compiled to C with extra temporary variables (such as uu____0) to enforce the same sequence of operations as the Rust source. To avoid unwanted optimizations that would break this ordering, the generated C code must be compiled with the -fno-strict-aliasing flag.
The image shows the Eurydice project's GitHub page, which describes how the compiler converts Rust to C, matching the article's explanation of the tool's purpose.
Eurydice currently handles only a subset of Rust features; it works best with small, self‑contained programs and can be tripped up by newer language capabilities such as const generics that cause Charon to fail when extracting MIR. Additionally, because Rust’s ownership and borrowing model does not map cleanly to C’s memory model, the translation often produces code that technically violates C’s strict‑aliasing rules, necessitating the aforementioned compiler flag and sometimes resulting in less idiomatic C output, though the project maintains that the semantic meaning of the original Rust code is preserved for verification purposes.