EvoC2Rust: A Skeleton-guided Framework for Project-Level C-to-Rust Translation

Chaofan Wang, Tingrui Yu, Beijun Shen, Jie Wang, Dong Chen +4 more
8/6/2025
42 citations
cs.SEcs.AI

No official code found. Best implementation: bbzswcf/EvoC2rust (11 stars, C, last commit 2025-10-02).

Abstract

Translating legacy C codebases to Rust is increasingly demanded for building safety-critical systems. While various approaches have emerged for this task, they face inherent trade-offs: rule-based methods often struggle to satisfy code safety and idiomaticity requirements, while LLM-based methods frequently fail to generate semantically equivalent Rust code, due to the heavy dependencies of modules across the entire codebase.

Show full abstract

Recent studies have revealed that both solutions are limited to small-scale programs. In this paper, we propose EvoC2Rust, an automated framework for converting complete C projects to equivalent Rust ones. EvoC2Rust employs a skeleton-guided translation strategy for project-level translation. The pipeline consists of three stages: 1) it first decomposes the C project into functional modules, employs a feature-mapping-enhanced LLM to transform definitions and macros, and generates type-checked function stubs, which form a compilable Rust skeleton; 2) it then incrementally translates functions, replacing the corresponding stub placeholders; 3) finally, it repairs compilation errors by integrating LLM and static analysis. Through evolutionary augmentation, EvoC2Rust combines the advantages of both rule-based and LLM-based solutions. Our evaluation on open-source benchmarks and six industrial projects demonstrates the superior performance of EvoC2Rust in project-level C-to-Rust translation. The results show that our approach outperforms the strongest LLM-based baseline by 17.24% in syntax accuracy and 14.32% in semantic accuracy, while also achieving a 43.59% higher code safety rate than the best rule-based tool.

View on arXivView PDF

Code Implementations(1)

bbzswcf/EvoC2rustCommunity72%

Code and datasets for our paper on “EvoC2Rust: A Skeleton-guided Framework for Project-Level C-to-Rust Translation”.

117C, RustSep 21, 20251 years ago

Similar Papers

Cite this paper

@article{wang2025evocrust,
  title  = {EvoC2Rust: A Skeleton-guided Framework for Project-Level C-to-Rust Translation},
  author = {Chaofan Wang and Tingrui Yu and Beijun Shen and Jie Wang and Dong Chen and Wenrui Zhang and Yuling Shi and Chen Xie and Xiaodong Gu},
  year   = {2025},
  eprint = {2508.04295},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2508.04295v4}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2508.04295.svg)](https://codeofpaper.com/paper/2508.04295)

Discussion