English

Translating C To Rust: Lessons from a User Study

Software Engineering 2024-12-09 v2 Cryptography and Security Programming Languages

Abstract

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.

Keywords

Cite

@article{arxiv.2411.14174,
  title  = {Translating C To Rust: Lessons from a User Study},
  author = {Ruishi Li and Bo Wang and Tianyu Li and Prateek Saxena and Ashish Kundu},
  journal= {arXiv preprint arXiv:2411.14174},
  year   = {2024}
}

Comments

Accepted by NDSS Symposium 2025. Please cite the conference version of this paper, e.g., "Ruishi Li, Bo Wang, Tianyu Li, Prateek Saxena, Ashish Kundu. Translating C To Rust: Lessons from a User Study. In 32nd Annual Network and Distributed System Security Symposium (NDSS 2025)."

R2 v1 2026-06-28T20:07:51.078Z