Replacing Output Parameters with Algebraic Data Types in C-to-Rust Translation

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.

Authors

Institutions

Publication Details

Journal
ACM Transactions on Software Engineering and Methodology
Published
2026-10-28
DOI
https://doi.org/10.1145/3860636
Primary Topic
Software Engineering Research
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Replacing Output Parameters with Algebraic Data Types in C-to-Rust Translation

Jaemin Hong, Sukyoung Ryu, Hyunhee Kang
4 links
ACM Transactions on Software Engineering and Methodology
Software Engineering Research
article

Replacing Output Parameters with Algebraic Data Types in C-to-Rust Translation

Jaemin Hong, Sukyoung Ryu, Hyunhee Kang
article en

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.

ACM Transactions on Software Engineering and Methodology
Korea Advanced Institute of Science and Technology (KR), Yale University (US)
Openalex Percentile: Top 6%
Software Engineering Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon