Documentation-Guided Agentic Codebase Migration from C to Rust

๐Ÿ“… 2026-05-14
๐Ÿ“ˆ Citations: 0
โœจ Influential: 0
๐Ÿ“„ PDF

career value

187K/year
๐Ÿค– AI Summary
This work addresses the limitations of existing C-to-Rust migration tools, which often perform only localized code translation and fail to preserve high-level architectural intent. To overcome this, we propose RustPrint, a novel framework that introduces, for the first time, a documentation-guided multi-agent collaboration mechanism. RustPrint transforms the source codebase into a structured migration blueprint, orchestrating multiple agents to jointly handle module decomposition, Rust implementation, compilation validation, and unsafe optimization. The framework iteratively refines the output through documentation consistency checks and test feedback. Evaluated on eight real-world C projects (11Kโ€“84K lines of code), RustPrint achieves 100% compilation success, 93.26% functional fidelity, and a 95.17% test pass rate, substantially outperforming current large language modelโ€“based migration approaches.
๐Ÿ“ Abstract
Migrating legacy C repositories to Rust promises stronger memory safety, but existing translators often work at the level of files or functions and miss architectural intent. We present RustPrint, a documentation-guided agentic framework for repository-level C-to-Rust migration. RustPrint first converts the source repository into architecture-aware documentation and treats it as a migration blueprint capturing module structure, data flow, APIs, and design rationale. Coding agents then use this blueprint to plan crates, implement modules, check compilability, reduce unsafe code, and iteratively refine the translated repository. RustPrint next compares documentation from the Rust output against the source documentation and uses mismatches as repair signals. It also translates and runs source test suites so runtime failures can guide targeted fixes. Experiments on eight real-world C repositories ranging from 11K to 84K LoC show that RustPrint compiles every target under both an open-weight (Kimi-K2-Instruct) and a closed-weight (GPT-5.4) backbone, while prior LLM-based translators (Self-Repair, EvoC2Rust) fail repository-wide. With the open-weight Kimi-K2-Instruct backbone, RustPrint exceeds an agentic Claude Code baseline on feature preservation (93.26% vs. 52.52%) and on cross-evaluation test pass rate (95.17% vs. 79.85%). These results suggest that documentation-guided coordination is a useful direction for scalable codebase migration.
Problem

Research questions and friction points this paper is trying to address.

code migration
C to Rust
repository-level translation
architectural intent
legacy code
Innovation

Methods, ideas, or system contributions that make the work stand out.

documentation-guided migration
agentic code translation
repository-level refactoring
architecture-aware documentation
unsafe code reduction