Migrating 80,000 lines of C code to Rust—not through manual rewriting or rule-based translation, but by having AI *understand* the codebase before touching it.
Rust promises memory safety, yet C codebases remain the backbone of the internet: kernels, network stacks, embedded firmware. C's pointer model has fueled memory-safety vulnerabilities for decades. Translating C to Rust is industry consensus, but the cost of hand-writing 80k lines is unaffordable.
Existing approaches split into two camps: rule-based translation (C2Rust) produces unsafe-riddled "C-style Rust"; direct LLM translation often misses cross-file architectural logic.
Researchers at FPT Software AI Center and the University of Melbourne argue: the problem isn't translation itself—it's the missing "understanding" step before translation.
1. Core Idea: Write the Docs Before the Code
RustPrint's workflow mirrors what a human engineer would do: understand the codebase structure, draw a blueprint, then build to spec.
Phase 1: Generate the blueprint. The DocGen module scans the entire C codebase and produces structured architecture documentation—how modules are organized, how data flows, where API boundaries lie. Not just "function name + parameter list," but high-level descriptions capturing architectural intent.
Phase 2: Build from the blueprint. A Planner Agent creates crate-level plans from the docs. Translator Agents port crate by crate, validating compilation with cargo_check as they go—write a line, test a line, like any human programmer.
Phase 3: Doc diffing to find omissions. After translation, DocGen documents the generated Rust code and compares it with the original C documentation. Features not covered by the docs are missing features; RequirementRefiner patches them in a targeted way.
Phase 4: Run tests to catch bugs. TestTranslator ports C tests to Rust, and ExecutionRevisor runs them one by one, fixing runtime errors.
> On the doc-comparison implementation—the paper uses CodeWikiBench scoring to quantify "documentation equivalence." But I'm unsure about its granularity: can it catch cases where "all features exist but behavioral details drift"? The paper treats doc equivalence as a proxy for functional equivalence, and I don't fully grasp how well that approximation holds.
2. Experimental Results
On 8 real C codebases (11k–84k lines):
- Compilation success rate: Both RustPrint backends passed fully. Self-Repair and EvoC2Rust failed entirely.
- Functional retention: RustPrint 93.26%–97.76%. Claude Code only 48.87%–52.52%.
- Cross-testing pass rate: RustPrint (GPT-5.4) 98.70%, Claude Code 79.85%.
- Safety: RustPrint API safe rate 99.41%; C2Rust 0%; Claude Code 99.09% but with higher file-level unsafety.
- Title: Documentation-Guided Agentic Codebase Migration from C to Rust
- Authors: Minh Le-Anh, Anh Nguyen Hoang, Bach Le, Nghi D. Q. Bui (FPT Software AI Center; University of Melbourne)
- Preprint: arXiv:2605.14634 (cs.SE)
- Submitted: May 14, 2026
- Core contribution: RustPrint, a documentation-driven multi-agent framework for repository-level C→Rust migration, achieving 93.26%–97.76% functional retention
- Paper link: https://arxiv.org/abs/2605.14634
The gap isn't a few percentage points—it's nearly a factor of two.
3. Why Does Documentation-Driven Translation Work So Well?
My take: the gap between "direct translation" and "documentation-driven translation" is essentially the gap between copying homework and understanding the material first.
Problems with direct translation (LLM reads C, writes Rust): cross-file architectural information is lost in function-level translation. A struct's design intent—why this field lives here—is invisible in single-function context. The LLM can only make "locally optimal" translations, distorting the overall architecture.
Documentation first extracts architectural intent into a global document; agents translate with reference to that document rather than snippets scattered across hundreds of files. Doc diffing also automatically reveals "what's missing."
> What I'm less sure about: the documentation itself is LLM-generated. If DocGen produces flawed docs (say, misinterpreting a module's responsibility), the entire translation is built on a faulty foundation. Downstream doc comparison can't distinguish "translation error" from "source doc error." The paper doesn't analyze this error-propagation risk.
4. My Take
RustPrint shares something with previously covered PGR and Mirror Touch Net: it doesn't patch the existing pipeline—it redesigns how AI approaches the task.
C-to-Rust migration isn't a "translation problem"—it's a "comprehension problem." RustPrint sees that clearly.
That said, multi-agent orchestration and repeated LLM calls aren't cheap. In high-stakes scenarios like rewriting infrastructure code, spending extra compute for reliability is probably worth it. But for everyday small-project migrations, this approach may be too heavy.
Paper Info
References
1. Le-Anh, M., et al. (2026). Documentation-Guided Agentic Codebase Migration from C to Rust. arXiv:2605.14634. 2. Ling, M., et al. (2022). In Rust We Trust – A Transpiler from Unsafe C to Safer Rust. 3. Wang, E., et al. (2025). EVOC2RUST. 4. Hoang, A. N., et al. (2025). CodeWiki. 5. Hong, S., et al. (2024). MetaGPT.