July 10, 2026

Rust never sleeps, and neither do skeptics

Cpp2Rust: Translates C++ to safe Rust automatically

This tool promises to turn old C++ into safe Rust, and the comments are already fighting

TLDR: Cpp2Rust says it can automatically convert C++ into safer Rust, a big deal for teams stuck with old code. Commenters were intrigued but instantly skeptical, demanding tougher examples and pointing out a brutal list of things the tool still can’t handle.

A new project called Cpp2Rust is making a huge promise: take C++ code — the famously sharp, crash-prone programming language behind tons of old software — and automatically turn it into safe Rust, the newer language adored for preventing nasty memory bugs. On paper, that sounds like the kind of thing developers dream about at 2 a.m. while staring at a legacy codebase. In the comments, though, the reaction was less "we are so back" and more "show me the messy stuff".

The loudest complaint? The demo was almost comically polite. One commenter basically asked why the showcase avoids truly dangerous C++ if the whole selling point is surviving dangerous C++. Another said the readme needs real-world examples: raw pointers, weird operator tricks, inheritance — all the cursed old-code gremlins people actually care about. Then came the record-scratch moment: someone highlighted the long list of unsupported features, from exceptions and goto to multiple inheritance and multithreaded code, turning the hype into a classic internet pile-on of "okay, but can it handle the bad parts?"

Still, not everyone came just to dunk. Miguel de Icaza dropped a deadpan AI-era joke — basically, "tell Codex to port the codebase" — and another commenter went full galaxy brain, wondering whether translating C++ into safe Rust could actually help prove the original C++ was safe too. So yes, the tool is impressive, but the real show is the comment section: half amazed, half suspicious, fully caffeinated.

Key Points

  • Cpp2Rust is described as a syntax-driven translator that automatically converts C++ into fully safe Rust using clang’s AST.
  • The translation pipeline parses C++ with clang, traverses the AST to emit Rust code, inserts libcc2rs runtime calls where needed, and formats output with rustfmt.
  • The default mode uses a reference counting model to generate fully safe Rust, while `--model=unsafe` can generate unsafe Rust for debugging and performance comparison.
  • The runtime library libcc2rs provides a `Ptr<T>` type that models C pointer semantics such as null, arithmetic, and aliasing through checked run-time operations.
  • The article includes installation, build, testing, and usage instructions for translating single files and whole programs, plus a minimal hello-world example.

Hottest takes

"Why does the example not show an example of unsafe C++?" — z_open
"codex '/goal port this codebase from c++ to rust'" — migueldeicaza
"Please provide:" — crnakfls
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.