Translating C To Rust: Lessons from a User Study
摘要
Rust aims to offer full memory safety for programs, a guarantee that untamed C programs do not enjoy. How difficult is it to translate existing C code to Rust? To get a complementary view from that of automatic C to Rust translators, we report on a user study asking humans to translate real-world C programs to Rust. Our participants are able to produce safe Rust translations, whereas state-of-the-art automatic tools are not able to do so. Our analysis highlights that the high-level strategy taken by users departs significantly from those of automatic tools we study. We also find that users often choose zero-cost (static) abstractions for temporal safety, which addresses a predominant component of runtime costs in other full memory safety defenses. User-provided translations showcase a rich landscape of specialized strategies to translate the same C program in different ways to safe Rust, which future automatic translators can consider.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 6 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Project-Level C-to-Rust Translation via Pointer Knowledge Graphs 引用了 Lost in Translation: A Study of Bugs Introduced by Large Language Models while Translating Code
- Project-Level C-to-Rust Translation via Pointer Knowledge Graphs 引用了 Translating C to safer Rust
- Scylla: Translating an Applicative Subset of C to Safe Rust 引用了 Lost in Translation: A Study of Bugs Introduced by Large Language Models while Translating Code
- Scylla: Translating an Applicative Subset of C to Safe Rust 引用了 Translating C to safer Rust
- &inator: Correct, Precise C-to-Rust Interface Translation 引用了 Scylla: Translating an Applicative Subset of C to Safe Rust
- &inator: Correct, Precise C-to-Rust Interface Translation 引用了 Translating C to safer Rust
- SmartC2Rust: Iterative, Feedback-Driven C-to-Rust Translation via Large Language Models for Safety and Equivalence 引用了 Lost in Translation: A Study of Bugs Introduced by Large Language Models while Translating Code
- SmartC2Rust: Iterative, Feedback-Driven C-to-Rust Translation via Large Language Models for Safety and Equivalence 引用了 Translating C to safer Rust
- Cpp2Rust: Automatic Translation of C++ to Safe Rust 引用了 Scylla: Translating an Applicative Subset of C to Safe Rust
- Cpp2Rust: Automatic Translation of C++ to Safe Rust 引用了 Translating C to safer Rust
- Cpp2Rust: Automatic Translation of C++ to Safe Rust 引用了 SmartC2Rust: Iterative, Feedback-Driven C-to-Rust Translation via Large Language Models for Safety and Equivalence
- PAC it up: Towards Pointer Integrity using ARM Pointer Authentication 引用了 Data-Oriented Programming: On the Expressiveness of Non-control Data Attacks
引用它的顶会 Paper6
- Scylla: Translating an Applicative Subset of C to Safe RustAymeric Fromherz, Jonathan ProtzenkoOOPSLA 2026 · 6 次引用
- SmartC2Rust: Iterative, Feedback-Driven C-to-Rust Translation via Large Language Models for Safety and EquivalenceMomoko Shiraishi, Yinzhi Cao, Takahiro ShinagawaICSE 2026 · 4 次引用
- &inator: Correct, Precise C-to-Rust Interface TranslationVictor Chen, Ayden Coughlin, Michael D. BondPLDI 2026 · 1 次引用
- Cpp2Rust: Automatic Translation of C++ to Safe RustLucian Popescu, Francisco Gouveia, Henrique Preto, João Silveira 等PLDI 2026 · 1 次引用
- Project-Level C-to-Rust Translation via Pointer Knowledge GraphsZhiqiang Yuan, Wenjun Mao, Zhuo Chen, Xiyue Shang 等FSE 2026
它引用的 Paper13
- Data-Oriented Programming: On the Expressiveness of Non-control Data AttacksHong Hu, Shweta Shinde, Sendroiu Adrian, Zheng Leong Chua 等S&P 2016 · 420 次引用
- PAC it up: Towards Pointer Integrity using ARM Pointer AuthenticationHans Liljestrand, Thomas Nyman, Kui Wang, Carlos Chinea Perez 等USENIX Security 2019 · 168 次引用
- Lost in Translation: A Study of Bugs Introduced by Large Language Models while Translating CodeRangeet Pan, Ali Reza Ibrahimzada, Rahul Krishna, Divya Sankar 等ICSE 2024 · 96 次引用
- Using Safety Properties to Generate Vulnerability PatchesZhen Huang, David Lie, Gang Tan, Trent JaegerS&P 2019 · 91 次引用
- Translating C to safer RustMehmet Emre, Ryan Schroeder, Kyle Dewey, Ben HardekopfOOPSLA 2021 · 60 次引用
相关 Paper
- Aliasing Limits on Translating C to Safe RustMehmet Emre, Peter Boyland, Aesha Parekh, Ryan Schroeder 等OOPSLA 2023 · 32 次引用
- Ownership Guided C to Rust TranslationHanliang Zhang, Cristina David, Yijun Yu, Meng WangCAV 2023 · 37 次引用
- VERT: Polyglot Verified Equivalent Rust Transpilation with Large Language ModelsAidan Z. H. Yang, Yoshiki Takashima, Brandon Paulsen, Josiah Dodds 等ASE 2025 · 1 次引用
- Concrat: An Automatic C-to-Rust Lock API Translator for Concurrent ProgramsJaemin Hong, Sukyoung RyuICSE 2023 · 17 次引用
- Is rust used safely by software developers?Ana Nora Evans, Bradford Campbell, Mary Lou SoffaICSE 2020 · 57 次引用
