Scylla: Translating an Applicative Subset of C to Safe Rust
Aymeric Fromherz, Jonathan Protzenko
Institut national de recherche en sciences et technologies du numérique · Google (United States)
Key points
From the paper's conclusion- We instead advocate for a different approach, where the programmer iterates on the original C, gradually making the code more structured until it becomes eligible for compilation to safe Rust.
Abstract
The popularity of the Rust language continues to explode; yet, many critical codebases remain authored in C. Automatically translating C to Rust is thus an appealing course of action. Several works have gone down this path, handling an ever-increasing subset of C through a variety of Rust features, such as unsafe. While the prospect of automation is appealing, producing code that relies on unsafe negates the memory safety guarantees offered by Rust, and therefore the main advantages of porting existing codebases to memory-safe languages. We instead advocate for a different approach, where the programmer iterates on the original C, gradually making the code more structured until it becomes eligible for compilation to safe Rust. This means that redesigns and rewrites can be evaluated incrementally for performance and correctness against existing test suites and production environments. Compiling structured C to safe Rust relies on the following contributions: a type-directed translation from (a subset of) C to safe Rust; a novel static analysis based on “split trees” which allows expressing C’s pointer arithmetic using Rust’s slices and splitting operations; an analysis that infers which borrows need to be mutable; and a compilation strategy for C pointer types that is compatible with Rust’s distinction between non-owned and owned allocations. We evaluate our approach on real-world cryptographic libraries, binary parsers and serializers, and a file compression library. We show that these can be rewritten to Rust with small refactors of the original C code, and that the resulting Rust code exhibits similar performance characteristics as the original C code. As part of our translation process, we also identify and report undefined behaviors in the bzip2 compression library and in Microsoft’s implementation of the FrodoKEM cryptographic primitive.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- C2SaferRust: Transforming C Projects Into Safer Rust With NeuroSymbolic TechniquesIEEE Transactions on Software Engineering · 2025
- SpeC2Rust: Specification-Driven Repository-Level C-to-Rust TranslationarXiv · 2026
- Replacing Output Parameters with Algebraic Data Types in C-to-Rust TranslationACM Transactions on Software Engineering and Methodology · 2026
- Beyond Source Code: Evaluating Natural Language Specifications for LLM-Based C-to-Rust TranslationarXiv · 2026
- Where Does the Performance Go? Understanding and Recovering Performance Regressions in C-to-Rust TranslationarXiv · 2026
- Req2Rust: A Requirements-Guided Agent Harness for Project-Level C++-to-Rust MigrationarXiv · 2026