c2rust is a source-to-source translation suite and C-to-Rust transpiler designed to convert C source code and libraries into functionally equivalent unsafe Rust code. It operates as a pipeline that preserves original behavior and data structures, producing translated code that compiles as compatible shared libraries or Rust crates.
The system includes an automated Rust refactoring framework that uses pattern-based AST rewriting to transform unsafe Rust into safe, idiomatic constructs. It utilizes an ownership inference engine to determine when raw pointers can be converted into safe references or owned values, and it generates byte-compatible bitfield structs with typed accessors.
To ensure correctness, the project provides cross-execution verification tools that instrument binaries to detect state discrepancies and verify execution parity at the function-call level. The suite also covers structural refactoring, automated type error correction, and the generation of build files and crate directories for the translated output.