SafeTrans: LLM-assisted Transpilation from C to Rust
Not on the map. Why?
Abstract (arXiv)
Rust is a strong contender for a memory-safe alternative to C as a "systems" language, but porting the vast amount of existing C code to Rust remains daunting. In this paper, we evaluate the potential of large language models (LLMs) to automate the transpilation of C code to idiomatic Rust. We present SafeTrans, a generic framework that leverages LLMs to i) transpile C code into Rust, and ii) iteratively repair compilation and runtime errors. A key novelty of our approach is a few-shot guided repair technique for translation errors, which provides contextual information and example code snippets for specific error types, guiding the LLM toward the correct solution. Another novel aspect of our work is the evaluation of the security implications of the transpilation process, showing how some vulnerability classes in C persist in the translated Rust code. SafeTrans was evaluated with six leading LLMs on 2,653 C programs and two real-world C projects. Our results show that iterative repair improves the rate of successful translations from 54% to 80% for the best-performing LLM (gpt-4o).
Key facts. Cited by 8 papers in the map (data through 14 Oct 2026). First posted on arXiv 15 May 2025.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2025: 3; 2026: 5.
8 papers.
- 2025EvoC2Rust: A Skeleton-guided Framework for Project-Level C-to-Rust Translationcited by 19
- 2025Adversarial Agent Collaboration for Correctness Improvements of C to Safe Rust Translationcited by 3
- 2025Project-Level C-to-Rust Translation via Pointer Knowledge Graphscited by 3
- 2026His2Trans: A Knowledge-Guided Agentic Framework for Project-Level C-to-Rust Migrationcited by 1
- 2026ORBIT: Guided Agentic Orchestration for Autonomous C-to-Rust Transpilationcited by 1
- 2026Towards Reliable C-to-Rust Translation with Rule-Guided Reasoning and Reinforcement Learningcited by 0
- 2026Fine-Tuning Qwen3-27B for C-to-Rust Code Translation: A Three-Stage Curriculum of Pretraining, Debugging-Aware SFT, and Task-Specific SFTcited by 0
- 2026Translator vs. Challenger: Adversarial Agentic Learning for C-to-Rust Translationcited by 0
- 2026Translator vs. Challenger: Adversarial Agentic Learning for C-to-Rust Translation14 Sep 2026
- 2026Fine-Tuning Qwen3-27B for C-to-Rust Code Translation: A Three-Stage Curriculum of Pretraining, Debugging-Aware SFT, and Task-Specific SFT13 Aug 2026
- 2026Towards Reliable C-to-Rust Translation with Rule-Guided Reasoning and Reinforcement Learning22 Jul 2026
- 2026ORBIT: Guided Agentic Orchestration for Autonomous C-to-Rust Transpilation13 Apr 2026
- 2026His2Trans: A Knowledge-Guided Agentic Framework for Project-Level C-to-Rust Migration3 Mar 2026
- 2025Project-Level C-to-Rust Translation via Pointer Knowledge Graphs13 Oct 2025
- 2025Adversarial Agent Collaboration for Correctness Improvements of C to Safe Rust Translation4 Oct 2025
- 2025EvoC2Rust: A Skeleton-guided Framework for Project-Level C-to-Rust Translation6 Aug 2025