Skip to content
Open access

Agentic C to Rust Translation

2026 · IEEE Security & Privacy · 0 citations · 13 references

Abstract

— The Rust programming language provides stronger guarantees about memory safety than C. Therefore, translating C to Rust is one way to reduce security vulnerabilities. One common translation strategy uses LLM queries. We present an alternative agentic approach that gives an LLM freedom and guardrails, and a publicly available implementation named ACTOR that outperforms all previous tools. When programming in C, a programmer must manually manage memory and other resources, such as by calling free after each call to malloc or by calling fclose after each call to fopen . It is easy to violate these rules, leading to memory corruption, resource exhaustion, and security vulnerabilities. This is a serious problem, because much of the world’s critical software infrastructure is written in C. The systems programming language Rust is a promising replacement for C. Rust prevents many errors via compile-time analyses, such as for type-checking and ownership. There is a growing movement to replace software written in C by safer versions written in Rust. To date, that replacement has required manual rewriting, which is time-consuming, costly, and unscalable. An alternative approach is to automatically translate C to Rust. Previous C-to-Rust translation tools fall into three categories. Rule-based transpilers like C2Rust [3], Crown [14], and Laertes [2] use language-specific AST transformations and are pinned to specific compiler versions. They break when the input does not match their expectations and cannot be adapted to other language pairs without a complete rewrite. Since they largely target a Rust-specific problem, unsafe blocks, their ideas may not even generalize to other target languages. LLM-assisted translators like SmartC2Rust [13] and C2SaferRust [6] use LLMs for code generation but wrap them in substantial language-specific infrastructure: AST parsers, macro transformers, error-code classifiers, and language-specific segmentation (splitting the C program into small pieces before translating, using knowledge

Read PDF

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.