Forcrat: Automatic I/O API Translation from C to Rust via Origin and Capability Analysis
Not on the map. Why?
Abstract (arXiv)
Translating C to Rust is a promising way to enhance the reliability of legacy system programs. Although the industry has developed an automatic C-to-Rust translator, C2Rust, its translation remains unsatisfactory. One major reason is that C2Rust retains C standard library (libc) function calls instead of replacing them with functions from the Rust standard library (Rust std). However, little work has been done on replacing library functions in C2Rust-generated code. In this work, we focus on replacing the I/O API, an important subset of library functions. This poses challenges due to the semantically different designs of I/O APIs in libc and Rust std. First, the two APIs offer different sets of types that represent the origins (e.g., standard input, files) and capabilities (e.g., read, write) of streams used for I/O. Second, they use different error-checking mechanisms: libc uses internal indicators, while Rust std uses return values. To address these challenges, we propose two static analysis techniques, origin and capability analysis and error source analysis, and use their results to replace the I/O API. Our evaluation shows that the proposed approach is (1) correct, with all 32 programs that have test suites passing the tests after transformation, (2) efficient, analyzing and transforming 422k LOC in 14 seconds, and (3) widely applicable, replacing 82% of I/O API calls.
Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). First posted on arXiv 2 Jun 2025.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2025: 2; 2026: 3.
5 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
- 2026His2Trans: A Knowledge-Guided Agentic Framework for Project-Level C-to-Rust Migrationcited by 1
- 2026Documentation-Guided Agentic Codebase Migration from C to Rustcited 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
- 2026Documentation-Guided Agentic Codebase Migration from C to Rust14 May 2026
- 2026His2Trans: A Knowledge-Guided Agentic Framework for Project-Level C-to-Rust Migration3 Mar 2026
- 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