-
Notifications
You must be signed in to change notification settings - Fork 273
Description
Dear C2Rust maintainers,
We’ve developed an automated tool for repository-level translation of C projects to their equivalent version in idiomatic Rust. Using this tool, we’ve generated a Rust translation of this code, including both application code and test code. Translation of the entire repository is 100% compilable and runnable using the translated tests.
Some quick stats from our translations:
Project | Ptr Arith. (C→our result) | Raw Ptrs (decl/deref) | Unsafe (lines/casts/calls) |
---|---|---|---|
genann | 28 -> 0 | 62/93 -> 1/4 | 43/8/21 |
grabc | 1 -> 2 | 19/15 -> 15/7 | 112/15/51 |
qsort | 0 -> 0 | 2/4 -> 0/0 | 0/0/0 |
robotfindskitten | 0 -> 4 | 1/0 -> 1/0 | 20/1/8 |
snudown | 5 -> 2 | 441/44 -> 8/0 | 52/17/38 |
urlparser | 17 -> 0 | 82/49 -> 0/0 | 0/0/0 |
xzoom | 40 -> 21 | 13/24 -> 21/17 | 453/57/274 |
- We have manually generated C tests for qsort, grabc, xzoom and robotfindskitten, all of their assertions passing on the original C code. Execution of translated tests on the Rust translation passes all the assertions, demonstrating a lower bound for functional equivalence.
While the translation may not be 100% equivalent or can be improved, it offers a solid starting point for a safe and idiomatic Rust version of this project.
If you're interested, we’d be happy to open a pull request with the translated version for your review. We're also open to feedback and collaboration if you’d like to help guide the tool’s development.
Let us know if you’d like us to proceed with a PR!