Cpp2Rust/cpp2rust
Cpp2Rust: Automatic Translation of C++ to Safe Rust
Build with Backblaze B2
SDKs, agent skills, IDE extensions, and reference pipelines from Backblaze Labs. All open source.
Loading star history...
Where it stands
Rank, growth pace and release cadence relative to everything GStars tracks.
The project lists 8 contributors on GitHub.
Peaked at #44 in the weekly ranking the week of Jul 12, its best in the past year.
Use Cases & Benefits
- Translates C++ code into fully safe Rust automatically using clang's AST and a runtime library for pointer semantics.
- Ensures memory safety by default through a reference counting model and runtime checks, reducing manual Rust unsafe code.
- Use for migrating legacy C++ projects to safe Rust without rewriting code manually.
- Use for generating Rust bindings from C++ codebases to leverage Rust's safety in mixed-language projects.
- Use for benchmarking and comparing safe versus unsafe Rust translations of C++ code for performance analysis.
Should you depend on it?
License terms, project hygiene and risks, from GitHub metadata and GStars' snapshots.
License
MIT
Permissive: commercial use, modification and redistribution are allowed with attribution.
Community files
- README: present
Watch-outs
- No GitHub releases; pin a commit or tag instead of a release.
General guidance from repository metadata, not legal advice. How we score
From the README
Cpp2Rust translates C++ to fully safe Rust automatically. It is a syntax-driven translator based on clang's AST.
Cpp2Rust's algorithm is described in the paper Cpp2Rust: Automatic Translation of C++ to Safe Rust published at PLDI 2026.
Cpp2Rust first parses the input C++ file(s) with clang and produces an AST. It then traverses the AST and emits Rust code as strings, inserting calls to the
libcc2rsruntime library where needed (e.g., for raw pointer semantics). Finally, the Rust code is pretty-printed usingrustfmtto a single.rsfile.By default the reference counting model is used, which produces fully safe Rust. A generator of unsafe Rust is also available through the
--model=unsafecommand line argument for debugging and performance comparisons.The generated code relies on a runtime library designed to simplify the translation process. C pointers are converted into the
Ptr<T>type provided bylibcc2rs.Ptr<T>models C pointer semantics, including null, arithmetic, and aliasing, while satisfying Rust's borrow checker through checked run-time operations.
Daily snapshots
Stars gained per day, and how forks and open issues moved, from GStars' daily snapshots
Forks
21+8
Open issues
11-6
Compared with peers in Backend
Fastest-growing repositories GStars tracks in this cohort for the week of Nov 1, by 7-day star growth
| Repository | Stars | +7d | Health | Last release |
|---|---|---|---|---|
| anthropics/skills | 187.8K | +2.9K | 15 | — |
| DuarteSantos8/openGym | 19.7K | +2.4K | 60 | 2 days ago |
| shiyu-coder/Kronos | 47.0K | +2.3K | 16 | — |
| NationalSecurityAgency/ghidra | 98.2K | +2.3K | 64 | 14 days ago |
| microsoft/VibeVoice | 56.0K | +1.1K | 29 | — |
| Cpp2Rust/cpp2rust | 319 | — | 35 | — |
| Category median | 56.0K | +2.3K | 29 | — |
Discover Repositories
Search across tracked repositories by name or description