










Abstract:C remains a major implementation language for operating systems, embedded platforms, and infrastructure software, but manual memory management continues to create security and maintenance costs. Rust is a practical migration target because it retains low-level control while enforcing stronger memory-safety checks. At project scale, especially under gradual C/Rust coexistence, migration is not a sequence of syntax-preserving function rewrites. A translator must preserve project interfaces, observable behavior, system interaction protocols, and low-level interoperability boundaries while staying consistent with migration choices already made in the codebase. We introduce His2Trans, a knowledge-guided agentic framework for project-level C-to-Rust migration. His2Trans reuses interface-level and fragment-level knowledge mined from historical C/Rust migrations to guide new translations toward Rust interfaces, wrapper choices, and local idioms already accepted in the evolving project. It then refines the assembled crate with project-level agentic feedback. On ten OpenHarmony modules, His2Trans reaches a 100.00\% incremental compilation pass rate, a 94.92\% Test Pass Rate, and a 16.35\% Unsafe Ratio. On eight open-source C projects, it reaches 100.00\% for both incremental compilation and Test Pass Rate, reducing Unsafe Ratio from 42.88\% under C2Rust to 8.59\%. These results support knowledge-guided migration and project-level agentic refinement as practical mechanisms for preserving observable behavior while reducing the unsafe burden of rule-based transpilation.
From: Shengbo Wang [view email]
[v1]
Tue, 3 Mar 2026 05:42:08 UTC (1,095 KB)
[v2]
Sat, 21 Mar 2026 14:35:10 UTC (1,095 KB)
[v3]
Fri, 27 Mar 2026 14:10:25 UTC (875 KB)
[v4]
Mon, 6 Jul 2026 03:56:22 UTC (720 KB)
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。