# Req2Rust: A Requirements-Guided Agent Harness for Project-Level C++-to-Rust Migration

DevFeed: [Req2Rust: A Requirements-Guided Agent Harness for Project-Level C++-to-Rust Migration](<https://devfeed.tech/articles/req2rust-a-requirements-guided-agent-harness-for-project-level-c-to-rust-migration-120814.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2611.07442>)

Author: Shengbo Wang, Mingwei Liu, Yuwen Chen, Yanlin Wang

Published: 2026-11-06T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Software Engineering](<https://devfeed.tech/sources/arxiv-software-engineering.md>)

Topics: [Agent Harness](<https://devfeed.tech/topics/agent-harness.md>), [Rust](<https://devfeed.tech/topics/rust.md>), [c/c++](<https://devfeed.tech/topics/c-c-plus-plus.md>), [Large Language Model](<https://devfeed.tech/topics/llm.md>), [Requirements](<https://devfeed.tech/topics/requirements.md>), [Specifications](<https://devfeed.tech/topics/specifications.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>)

Tags: [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [c-plus-plus-to-rust](<https://devfeed.tech/tags/c-plus-plus-to-rust.md>), [cs-se](<https://devfeed.tech/tags/cs-se.md>), [harness](<https://devfeed.tech/tags/harness.md>), [llm](<https://devfeed.tech/tags/llm.md>), [memory-safety](<https://devfeed.tech/tags/memory-safety.md>), [migration](<https://devfeed.tech/tags/migration.md>), [rust](<https://devfeed.tech/tags/rust.md>), [semantic](<https://devfeed.tech/tags/semantic.md>), [specification](<https://devfeed.tech/tags/specification.md>), [test](<https://devfeed.tech/tags/test.md>)

## AI overview

Req2Rust uses an evidence-grounded Migration Requirements Specification (MRS) to record behaviors and constraints to preserve, then derives a Rust Design Specification (RDS) and an initial Rust project. It treats that project as an executable refinement state: compiler, semantic, and unsafe-reduction validators report issues to guide improvements in buildability, behavioral alignment, and unsafe usage. In evaluations against a ClaudeCode baseline, Req2Rust produced buildable Rust crates and raised test pass rates from 69.5% to 91.9% on general projects and from 45.4% to 87.9% on OpenHarmony modules. The supplied abstract does not detail evaluation methods or the extent of unsafe-code reduction.

## Source excerpt

arXiv:2611.07442v1 Announce Type: new Abstract: Memory-safety concerns make Rust an attractive target for modernizing legacy C/C++ systems, yet project-level C++ migration must balance semantic fidelity with Rust-oriented reconstruction. Source-structure-preserving migration can track low-level behavior, but it can also carry source-language organization, unsafe idioms, and project assumptions into Rust. Direct agent-based translation gives the model more freedom to construct a Rust project, but semantic coverage depends on the model identifying the source behaviors that must be preserved. This problem is especially acute for C++, where source behaviors are often hidden in object models, destructor-driven lifetime protocols, and other hard-to-localize C++ semantics. This paper presents Req2Rust, the first project-level LLM-based C++-to-Rust migration harness. Req2Rust first derives an evidence-grounded Migration Requirements Specification (MRS) that records the behaviors and constraints that must be preserved. It then synthesizes a Rust Design Specification (RDS) and realizes it as an initial Rust project. Because real projects contain implementation details and idioms that only become visible during build and validation, Req2Rust treats the initial Rust project as an executable refinement state. Compiler, semantic, and unsafe-reduction validators produce validation reports for improving buildability, behavioral alignment, and unsafe usage. We evaluate Req2Rust on general C++ projects and modules from the large-scale Openharmony codebase against a ClaudeCode baseline. Req2Rust produces buildable Rust crates in both settings and improves test pass rate from 69.5% to 91.9% on general projects and from 45.4% to 87.9% on Openharmony modules.