logoalt Hacker News

Cpp2Rust: Translates C++ to safe Rust automatically

39 pointsby signa11today at 4:24 PM11 commentsview on HN

Comments

crnakflstoday at 9:48 PM

> Notable unsupported constructs include: union, volatile, goto, exceptions, bitfields, placement new, user-defined copy/move constructors, dynamic_cast, const_cast, base classes with fields or non-virtual methods, multiple inheritance, and multi-threaded code.

show 2 replies
logicchoptoday at 9:33 PM

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?

show 2 replies
z_opentoday at 8:06 PM

Why does the example not show an example of unsafe C++?

show 1 reply
IshKebabtoday at 9:35 PM

Yeah the readme definitely needs some non-trivial examples. How does this handle raw pointers? Operator overloading? Inheritance?

dmitrygrtoday at 10:02 PM

The original paper quoth:

> our reference-counted translation model, where every variable is pessimistically wrapped inside a Rc<RefCell<T>> type, checks that would usually execute at compile-time are shifted to run time, degrading performance.

migueldeicazatoday at 9:04 PM

codex "/goal port this codebase from c++ to rust"