Skip to main content
zenodorestricted

C2SafeRust: Translating C to Safe Rust via incorporating In-context Learning and Program Structures into LLM

<p>This repository contains the code and dataset for the paper <strong>C2SafeRust: Translating C to Safe Rust via Incorporating In-Context Learning and Program Structures into LLM</strong> in FSE 2025.</p> <p><strong>C2SafeRust</strong> is an advanced tool designed to automatically translate C code into safe, readable, and maintainable Rust code. Leveraging in-context learning (ICL), C2SafeRust generates idiomatic Rust that adheres to Rust's safety guarantees. The tool employs detailed program structures, such as Control Flow Graphs (CFG) and Data Dependency Graphs (DDG), along with intermediate variable values obtained through program instrumentation. By integrating these elements with a Large Language Model (LLM), C2SafeRust ensures high syntactic and semantic correctness in the translation process, while maintaining the readability and maintainability of the resulting Rust code.</p>

ShareScore

20/100

Overall dataset sharing score

Score breakdown

These five areas show where the dataset supports — or may limit — practical reuse.

Stewardship
4
Harmonization
4
Access
8
Reuse readiness
0
Engagement
4