Lune

PLDI2024顶会

Don't Write, but Return: Replacing Output Parameters with Algebraic Data Types in C-to-Rust Translation

Jaemin Hong, Sukyoung Ryu

摘要

Translating legacy system programs from C to Rust is a promising way to enhance their reliability. To alleviate the burden of manual translation, automatic C-to-Rust translation is desirable. However, existing translators fail to generate Rust code fully utilizing Rust’s language features, including algebraic data types. In this work, we focus on tuples and Option/Result types, an important subset of algebraic data types. They are used as functions’ return types to represent those returning multiple values and those that may fail. Due to the absence of these types, C programs use output parameters , i.e., pointer-type parameters for producing outputs, to implement such functions. As output parameters make code less readable and more error-prone, their use is discouraged in Rust. To address this problem, this paper presents a technique for removing output parameters during C-to-Rust translation. This involves three steps: (1) syntactically translating C code to Rust using an existing translator; (2) analyzing the Rust code to extract information related to output parameters; and (3) transforming the Rust code using the analysis result. The second step poses several challenges, including the identification and classification of output parameters. To overcome these challenges, we propose a static analysis based on abstract interpretation, complemented by the notion of abstract read/write sets , which approximate the sets of read/written pointers, and two sensitivities: write set sensitivity and nullity sensitivity . Our evaluation shows that the proposed technique is (1) scalable, with the analysis and transformation of 190k LOC within 213 seconds, (2) useful, with the detection of 1,670 output parameters across 55 real-world C programs, and (3) mostly correct, with 25 out of 26 programs passing their test suites after the transformation.

问 Lune

几分钟看清这篇 Paper 的位置,不用再花一下午。

Lune 能读引用它和与它最相关的顶会 Paper,讲清它说了什么、后来怎样、哪里站不住,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 9 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

摘要 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • Hayroll: A Modular Wrapper for Translating C Macros and Conditional Compilation to Rust 引用了 Scylla: Translating an Applicative Subset of C to Safe Rust
  • Hayroll: A Modular Wrapper for Translating C Macros and Conditional Compilation to Rust 引用了 RustAssure: Differential Symbolic Testing for LLM-Transpiled C-to-Rust Code
  • Hayroll: A Modular Wrapper for Translating C Macros and Conditional Compilation to Rust 引用了 SACTOR: LLM-Driven Correct and Idiomatic C to Rust Translation with Static Analysis and FFI-Based Verification
  • Hayroll: A Modular Wrapper for Translating C Macros and Conditional Compilation to Rust 引用了 SmartC2Rust: Iterative, Feedback-Driven C-to-Rust Translation via Large Language Models for Safety and Equivalence
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper9

  1. RustAssure: Differential Symbolic Testing for LLM-Transpiled C-to-Rust CodeYubo Bai, Tapti PalitASE 2025 · 8 次引用
  2. SACTOR: LLM-Driven Correct and Idiomatic C to Rust Translation with Static Analysis and FFI-Based VerificationTianyang Zhou, Ziyi Zhang, Haowen Lin, Somesh Jha 等ACL 2026 · 8 次引用
  3. Scylla: Translating an Applicative Subset of C to Safe RustAymeric Fromherz, Jonathan ProtzenkoOOPSLA 2026 · 6 次引用
  4. SmartC2Rust: Iterative, Feedback-Driven C-to-Rust Translation via Large Language Models for Safety and EquivalenceMomoko Shiraishi, Yinzhi Cao, Takahiro ShinagawaICSE 2026 · 4 次引用
  5. Hayroll: A Modular Wrapper for Translating C Macros and Conditional Compilation to RustHaoran Peng, Baris Kasikci, Gilbert Louis Bernstein, Michael D. ErnstPLDI 2026 · 1 次引用

相关 Paper

  1. Forcrat: Automatic I/O API Translation from C to Rust via Origin and Capability AnalysisJaemin Hong, Sukyoung RyuASE 2025 · 1 次引用
  2. To Tag, or Not to Tag: Translating C's Unions to Rust's Tagged UnionsJaemin Hong, Sukyoung RyuASE 2024 · 6 次引用
  3. Aliasing Limits on Translating C to Safe RustMehmet Emre, Peter Boyland, Aesha Parekh, Ryan Schroeder 等OOPSLA 2023 · 32 次引用
  4. Ownership Guided C to Rust TranslationHanliang Zhang, Cristina David, Yijun Yu, Meng WangCAV 2023 · 37 次引用
  5. GenC2Rust: Towards Generating Generic Rust Code from CXiafa Wu, Brian DemskyICSE 2025 · 4 次引用
黄昏的海面,两侧是细线勾勒的悬崖