Elamur Research⌕
☰
home / papers / 2026 / SACTOR: LLM-Driven Correct and Idiomatic C to Rust Translation with Static Analysis and FFI-Based Verification

SACTOR: LLM-Driven Correct and Idiomatic C to Rust Translation with Static Analysis and FFI-Based Verification

Paper · 2026 · Tianyang Zhou, Ziyi Zhang, Haowen Lin et al.

Summary

Moving legacy C code to Rust can remove whole classes of memory bugs. Rule-based converters such as C2Rust produce Rust that leans heavily on unsafe, and plain LLM prompting gives no assurance that the result behaves like the original. SACTOR addresses both problems. A libclang-based C Parser splits a program into types, globals and functions and orders them by dependency. An LLM then translates each fragment, guided by static-analysis hints such as pointer semantics. Translation happens in two passes. The first is an interface-preserving "unidiomatic" Rust version, and the second refines it into safe, idiomatic Rust. Each fragment is linked back into the remaining C code through FFI, and the project's end-to-end tests must pass before the next fragment is attempted. Compiler errors and test failures are fed back to the model for repair. The authors evaluated SACTOR on 200 programs, on CRust-Bench and on the libogg library. It reached high correctness and produced far cleaner, unsafe-free code than earlier tools. This makes verified, incremental C-to-Rust migration with LLMs look practical.

Key points

  • Benchmarks and correctness: The evaluation used 200 programs from TransCoder-IR and CodeNet and compared five LLMs. With DeepSeek-R1, end-to-end correctness reached 93% and 84% on the two datasets. Code quality improved substantially, with up to 7× fewer Clippy warnings than baselines.
  • Safety of idiomatic output: Idiomatic outputs were 100% unsafe-free. By contrast, C2SaferRust kept substantial unsafe code, and C2Rust and Crown produced none that was unsafe-free.
  • CRust-Bench (50 samples): Unidiomatic translation averaged 85.15% per-sample function success, and 32 of 50 samples were fully translated. On those 32, idiomatic success averaged 51.85%, with 8 fully idiomatic. Clippy alerts per function dropped from 2.96 to 0.28.
  • libogg (77 functions): Unidiomatic translation succeeded for 100% of functions. Idiomatic success was 53% with GPT-4o and 78% with GPT-5, and GPT-5 needed fewer attempts (1.25 vs 2.00).
  • Diagnostics and availability: Compiler and test feedback raised weaker models' results by about 17%, and sampling temperature mattered little. Code and datasets are public at github.com/qsdrqs/sactor and sactor-datasets.

Our summary of the paper, in our own words — not its text. The work belongs to its authors; read it at the links above.

 Institutions

 Fields, topics and concepts

Cite

Cite as Tianyang Zhou, Ziyi Zhang, Haowen Lin, Somesh Jha, Mihai Christodorescu, Kirill Levchenko and Varun Chandrasekaran. 2026. SACTOR: LLM-Driven Correct and Idiomatic C to Rust Translation with Static Analysis and FFI-Based Verification. Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.18653/v1/2026.acl-long.28

@inproceedings{zhou2026sactor,
  title = {{SACTOR: LLM-Driven Correct and Idiomatic C to Rust Translation with Static Analysis and FFI-Based Verification}},
  author = {Tianyang Zhou, Ziyi Zhang, Haowen Lin, Somesh Jha, Mihai Christodorescu, Kirill Levchenko and Varun Chandrasekaran},
  booktitle = {Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
  year = {2026},
  doi = {10.18653/v1/2026.acl-long.28},
  url = {https://doi.org/10.18653/v1/2026.acl-long.28}
}

References

34 references, 1 of them with a card of ours. ↗ leads to the work, «find» searches for one we have no id for yet.

  1. Divyam Anshumaan, Tej Chajed, Varun Chandrasekaran, Alvin Cheung, Sarthak Choudhary, Adwait Godbole, Somesh Jha, Nils Palumbo, Elizabeth Polgreen, Sanjit A Seshia, and Tianyang Zhou. 2025. Llm-based code translation needs formal compositional reasoning. (UCB/EECS-2025-174). \#\# Acknowledgments We tha… find
  2. Roberto Baldoni, Emilio Coppa, Daniele Cono D’elia, Camil Demetrescu, and Irene Finocchi. 2018. A survey of symbolic execution techniques. ACM Computing Surveys (CSUR), 51(3):1–39. find
  3. P David Coward. 1988. Symbolic execution systems—a review. Software Engineering Journal, 3(6):229– 239. find
  4. Mehmet Emre, Ryan Schroeder, Kyle Dewey, and Ben Hardekopf. 2021. Translating c to safer rust. Proceedings of the ACM on Programming Languages, 5(OOPSLA):1–29. find
  5. Hasan Ferit Eniser, Hanliang Zhang, Cristina David, Meng Wang, Maria Christakis, Brandon Paulsen, Joey Dodds, and Daniel Kroening. 2024. Towards translating real-world code with llms: A study of translating to rust. arXiv preprint arXiv:2405.11514. — [arXiv:2405.11514](https://arxiv.org/abs/2405.11514) find
  6. Jiahao Fan, Yi Li, Shaohua Wang, and Tien N Nguyen. 2020. A c/c++ code vulnerability dataset with code changes and cve summaries. In Proceedings of the 17th International Conference on Mining Software Repositories, pages 508–512. find
  7. Jaemin Hong and Sukyoung Ryu. 2024. Don’t write, but return: Replacing output parameters with algebraic data types in c-to-rust translation. Proceedings of the ACM on Programming Languages, 8(PLDI):716– 740. find
  8. Ralf Jung, Jacques-Henri Jourdan, Robbert Krebbers, and Derek Dreyer. 2017. Rustbelt: Securing the foundations of the rust programming language. Proceedings of the ACM on Programming Languages, 2(POPL):1–34. find
  9. Anirudh Khatry, Robert Zhang, Jia Pan, Ziteng Wang, Qiaochu Chen, Greg Durrett, and Isil Dillig. 2025. Crust-bench: A comprehensive benchmark for c-to-safe-rust transpilation. arXiv preprint arXiv:2504.15254. — [arXiv:2504.15254](https://arxiv.org/abs/2504.15254) find
  10. James C King. 1976. Symbolic execution and program testing. Communications of the ACM, 19(7):385– 394. find
  11. Tianle Li, Ge Zhang, Quy Duc Do, Xiang Yue, and Wenhu Chen. 2024. Long-context llms struggle with long in-context learning. arXiv preprint arXiv:2404.02060.
  12. Hongliang Liang, Xiaoxiao Pei, Xiaodong Jia, Wuwei Shen, and Jian Zhang. 2018. Fuzzing: State of the art. IEEE Transactions on Reliability, 67(3):1199–1218. find
  13. Michael Ling, Yijun Yu, Haitao Wu, Yuan Wang, James R Cordy, and Ahmed E Hassan. 2022. In rust we trust: a transpiler from unsafe c to safer rust. In Proceedings of the ACM/IEEE 44th international conference on software engineering: companion proceedings, pages 354–355. find
  14. Xiang Liu, Peijie Dong, Xuming Hu, and Xiaowen Chu. 2024. Longgenbench: Long-context generation benchmark. arXiv preprint arXiv:2410.04199. find
  15. Robert Love. 2013. Linux system programming: talking directly to the kernel and C library. " O’Reilly Media, Inc.". find
  16. Nicholas D Matsakis and Felix S Klock. 2014. The rust language. ACM SIGAda Ada Letters, 34(3):103–104. find
  17. Barton P Miller, Lars Fredriksen, and Bryan So. 1990. An empirical study of the reliability of unix utilities. Communications of the ACM, 33(12):32–44. find
  18. MITRE. 2006a. CWE-121: Stack-based Buffer Overflow. find
  19. MITRE. 2006b. CWE-122: Heap-based Buffer Overflow. find
  20. MITRE. 2006c. CWE-401: Missing Release of Memory after Effective Lifetime. find
  21. MITRE. 2006d. CWE-416: Use After Free. find
  22. Marc Szafraniec, Baptiste Roziere, Hugh Leather Francois Charton, Patrick Labatut, and Gabriel Synnaeve. 2023. Code translation with compiler representations. ICLR. find
  23. TIOBE. 2025. TIOBE Index for January 2025. find
  24. Qilong Wu, Taoran Li, Tianyang Zhou, and Varun Chandrasekaran. 2025. Sok: Understanding (new) security issues across ai4code use cases. arXiv preprint arXiv:2512.18456. — [arXiv:2512.18456](https://arxiv.org/abs/2512.18456) find
  25. Xiph. 2025. Xiph/ogg: Reference implementation of the Ogg media container. find
  26. Aidan ZH Yang, Yoshiki Takashima, Brandon Paulsen, Josiah Dodds, and Daniel Kroening. 2024. Vert: Verified equivalent rust transpilation with large language models as few-shot learners. arXiv preprint arXiv:2404.18852. — [arXiv:2404.18852](https://arxiv.org/abs/2404.18852) find
  27. Hanliang Zhang, Cristina David, Yijun Yu, and Meng Wang. 2023. Ownership guided c to rust translation. In International Conference on Computer Aided Verification, pages 459–482. Springer. find
  28. Xiaogang Zhu, Sheng Wen, Seyit Camtepe, and Yang Xiang. 2022. Fuzzing: a survey for roadmap. ACM Computing Surveys (CSUR), 54(11s):1–36. find
  29. Vikram Nitin, Rahul Krishna, Luiz Lemos do Valle, and Baishakhi Ray. 2025. C2saferrust: Transforming c projects into safer rust with neurosymbolic techniques. arXiv preprint arXiv:2501.14257. — [arXiv:2501.14257](https://arxiv.org/abs/2501.14257) find
  30. Rangeet Pan, Ali Reza Ibrahimzada, Rahul Krishna, Divya Sankar, Lambert Pouguem Wassi, Michele Merler, Boris Sobolev, Raju Pavuluri, Saurabh Sinha, and Reyhaneh Jabbarvand. 2023. Understanding the effectiveness of large language models in code translation. CoRR. find
  31. Neil Perry, Megha Srivastava, Deepak Kumar, and Dan Boneh. 2023. Do users write more insecure code with ai assistants? In Proceedings of the 2023 ACM SIGSAC Conference on Computer and Communications Security, pages 2785–2799. find
  32. Ruchir Puri, David Kung, Geert Janssen, Wei Zhang, Giacomo Domeniconi, Vladmir Zolotov, Julian Dolby, Jie Chen, Mihir Choudhury, Lindsey Decker, Veronika Thost, Luca Buratti, Saurabh Pujar, Shyam Ramji, Ulrich Finkler, Susan Malaika, and Frederick Reiss. 2021. Codenet: A large-scale ai for code data… find
  33. Manish Shetty, Naman Jain, Adwait Godbole, Sanjit A Seshia, and Koushik Sen. 2024. Syzygy: Dual code-test c to (safe) rust translation using llms and dynamic analysis. arXiv preprint arXiv:2412.14234. — [arXiv:2412.14234](https://arxiv.org/abs/2412.14234) find
  34. Momoko Shiraishi and Takahiro Shinagawa. 2024. Context-aware code segmentation for c-to-rust translation using large language models. arXiv preprint arXiv:2409.10506. — [arXiv:2409.10506](https://arxiv.org/abs/2409.10506) find

Updated

↑ back to top

This page in Markdown → https://md.research.elamur.ai/free/en/papers/zhou-2026-sactor-llm-driven-correct-idiomatic/