News for hackers. Stuff that matters.
Re:Cpp2Rust: Translates C++ to safe Rust automatically by logicchop on Friday July 10, 2026 @05:33PM (#48865602)
If I can autoport my C++ to Rust, and the port is confirmed identical, and the Rust is confirmed safe, can't I use that to reason about the safety of my C++? Is safe C++ just a matter of proving it has a safe Rust equivalent?
Re:Cpp2Rust: Translates C++ to safe Rust automatically by johnbender on Friday July 10, 2026 @05:42PM (#48865693)
It depends on what “confirmed identical” means. Most compilers (or translators as you like) only guarantee that the output program represents a subset of the behaviors of the input program so it could be that subset is the “safe as in Rust” subset.
Re:Cpp2Rust: Translates C++ to safe Rust automatically by _flux on Friday July 10, 2026 @05:49PM (#48865755)
The conversions seem to use (sometimes?) unsafe blocks.
Re:Cpp2Rust: Translates C++ to safe Rust automatically by majorchord on Sunday July 12, 2026 @12:08AM (#48878165)
> the Rust is confirmed safe

keep in mind that rust:

- does not prevent logic errors

- does not prevent stack overflows

- does not prevent out of memory errors

- does not prevent bitflips caused by faulty hardware or cosmic rays

- does not prevent memory leaks

- does not prevent unrecoverable errors (panics)

- does not prevent memory safety related issues in an unsafe context

Re:Cpp2Rust: Translates C++ to safe Rust automatically by whytevuhuni on Sunday July 12, 2026 @02:45AM (#48878931)
GP is referring to the article's title, as in "safe Rust", as in "Rust with no unsafe keyword", as in whether it has undefined behavior or not.

Granted the premise is rather brittle, since all Cpp2Rust does is to convert UB to runtime crashes, which can be undecidable, and cannot be used to prove anything about the original C++ code.