Replacing Output Parameters with Algebraic Data Types in C-to-Rust Translation
Jaemin Hong, Hyunhee Kang, Sukyoung Ryu
Key points
From the paper's conclusion- To address this problem, this paper presents techniques for removing output parameters during C-to-Rust translation.
Abstract
Translating legacy systems from C to Rust promises to enhance their reliability. However, existing translators fail to generate Rust code that fully utilizes Rust's language features, such as algebraic data types. This work focuses on tuples and Option/Result types, an important subset of algebraic data types. These are used as return types to represent functions that return multiple values or may fail. Due to the absence of these types, C programs use output parameters , i.e., pointer-type parameters for producing outputs. As output parameters make code less readable and more error-prone, their use is discouraged in Rust. To address this problem, this paper presents techniques for removing output parameters during C-to-Rust translation. The main challenge is identifying and classifying output parameters. As a solution, we propose a static analysis accompanied by abstract read/write sets , which approximate the sets of read and written pointers, and two sensitivities: write set sensitivity and nullity sensitivity . Our evaluation shows the proposed approach is (1) efficient, processing up to 395k LOC within 386 seconds; (2) useful, identifying 3,287 output parameters across 97 real-world programs; and (3) test-validated, with all 38 programs that have test suites passing their tests after transformation when aliased pointer detection is enabled.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Scylla: Translating an Applicative Subset of C to Safe RustProceedings of the ACM on Programming Languages · 2026
- 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
- Where Does the Performance Go? Understanding and Recovering Performance Regressions in C-to-Rust TranslationarXiv · 2026
- Beyond Source Code: Evaluating Natural Language Specifications for LLM-Based C-to-Rust TranslationarXiv · 2026
- Re-Testing LLM-Based C-to-Rust Translations Against Their Original CarXiv · 2026