Papers › RustMap: Towards Project-Scale C-to-Rust Migration via Program Analysis and LLM

RustMap: Towards Project-Scale C-to-Rust Migration via Program Analysis and LLM

22 Mar 2025arXiv:2503.17741links table onlyarchive 2025-07-28

Xuemeng Cai, Jiakun Liu, Xiping Huang, Yijun Yu, Haitao Wu, Chunmiao Li, Bo Wang, Imam Nur Bani Yusuf, Lingxiao Jiang

The archive published only this paper's code-link row. Authors, date and abstract are from arXiv's metadata (CC0), read from the Kaggle arXiv metadata snapshot of 2026-09-12 where its title matched the archive's; the title is the archive's.

Migrating existing C programs into Rust is increasingly desired, as Rust offers superior memory safety while maintaining C's high performance. However, vastly different features between C and Rust--e.g., distinct definitions and usages of pointers and references--pose significant challenges beyond mere syntactic translation. Existing automated translation tools, such as C2Rust, may rely too much on syntactic, template-based translation and generate unsafe Rust code that is hard for human developers to read, maintain, or even compile. More semantic-aware translation that produces safer, idiomatic, and runnable Rust code is much needed. This paper introduces a novel dependency-guided and large language model (LLM)-based C-to-Rust translation approach, RustMap, based on three key ideas: (1) Utilize LLM capabilities to produce idiomatic Rust code from given small pieces of C code, (2) Mitigate LLM limitations in handling large codebases by breaking project-scale C programs into smaller units for translation according to their usage dependencies and composing them into a runnable Rust program, and (3) Enhance the correctness of the translated Rust program by using test cases to check input/output equivalence, isolate faulty code when execution states deviate, and iteratively refine the translation using feedback from compilation and test errors. We empirically evaluate RustMap on 126 real-world programs, including 125 from Rosetta Code and a 7000+ line bzip2 implementation using GPT-4o as the LLM. RustMap shows promising results, guiding GPT-4o to produce idiomatic, readable, and functional Rust code with significantly less unsafe code than other tools, and revealing non-trivial translation patterns reusable for future research.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2503.17741")

Code

Syntology Ran 0 of 20 code samples harvested from 1 repository linked to this paper; 20 have no recorded run.

By repository: official repository: 20 samples from 1 repository, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

cxm211/rustmap officialmentioned in paperApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

20 samples harvested; 0 ran; 0 honoured the contract we drafted; 20 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

20unverified

Licence: 0 of the 20 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from cxm211/rustmap. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

clean_string cxm211/rustmap/scaffolding_py_tools/GlobDep_FnDep.py official repository unverified Apache-2.0 (permissive) · 4eb083afe9e6bd3a · report
count_lines_in_directory cxm211/rustmap/c-code/bzip2-1.0.8-i/singapore.py official repository unverified Apache-2.0 (permissive) · 2f4cd585cf35d068 · report
count_lines_in_file cxm211/rustmap/c-code/bzip2-1.0.8-i/singapore.py official repository unverified Apache-2.0 (permissive) · ac30109274e9a668 · report
extract_cognitive_complexity cxm211/rustmap/cognitive_study/extract_cc.py official repository unverified Apache-2.0 (permissive) · 9787457200d42ba3 · report
extract_functions cxm211/rustmap/extract.py official repository unverified Apache-2.0 (permissive) · 0c26a4ac0d02b2af · report
extract_global_variables_from_ctags cxm211/rustmap/scaffolding_py_tools/treesitter_struct_analysis.py official repository unverified Apache-2.0 (permissive) · aab7ecf1c11c2607 · report
extract_globals cxm211/rustmap/extract.py official repository unverified Apache-2.0 (permissive) · f1a4f0cb7aabb7e0 · report
extract_signature cxm211/rustmap/scaffolding_py_tools/integrated_dependency_builder.py official repository unverified Apache-2.0 (permissive) · 7447f0d99ac965c6 · report
extract_tags_from_ctags cxm211/rustmap/scaffolding_py_tools/GlobDep_FnDep.py official repository unverified Apache-2.0 (permissive) · 5e2ea84a7e8202e2 · report
find_references cxm211/rustmap/scaffolding_py_tools/GlobDep_FnDep.py official repository unverified Apache-2.0 (permissive) · 3d645c51e39f023f · report
generate_cflow_dot cxm211/rustmap/cflow_generation.py official repository unverified Apache-2.0 (permissive) · 6a4f858935e13d32 · report
generate_graph cxm211/rustmap/scaffolding_py_tools/tarjan.py official repository unverified Apache-2.0 (permissive) · 561fa8cf9c49574f · report
get_logical_folder cxm211/rustmap/cognitive_study/extract_cc.py official repository unverified Apache-2.0 (permissive) · 68cc2c0e3130615e · report
get_node_source cxm211/rustmap/scaffolding_py_tools/treesitter_struct_analysis.py official repository unverified Apache-2.0 (permissive) · 4115c0d285b49000 · report
has_descendant_of_type cxm211/rustmap/scaffolding_py_tools/treesitter_struct_analysis.py official repository unverified Apache-2.0 (permissive) · db542def6c3115e2 · report
is_valid_scc cxm211/rustmap/scaffolding_py_tools/tarjan.py official repository unverified Apache-2.0 (permissive) · 83e372abaf366ef9 · report
process_folder cxm211/rustmap/extract.py official repository unverified Apache-2.0 (permissive) · 389c015ffde0ac64 · report
process_label cxm211/rustmap/scaffolding_py_tools/integrated_dependency_builder.py official repository unverified Apache-2.0 (permissive) · 106087b38eea780e · report
process_relationships cxm211/rustmap/scaffolding_py_tools/integrated_dependency_builder.py official repository unverified Apache-2.0 (permissive) · 3d1eb79d0ed0aacf · report
tarjan_scc cxm211/rustmap/scaffolding_py_tools/tarjan.py official repository unverified Apache-2.0 (permissive) · 7ca9f85e0ee49143 · report

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections