Live data from Hacker News

Emitting Safer Rust with C2Rust

immunant.com

1–10 of 50 posts

Re: Emitting Safer Rust with C2Rust

#3
This seems like an interesting project to bridge the "boil the ocean" approach of rewriting in Rust wholesale.

(For anyone else who found it slightly difficult to read, you can remove the added 0.06em `letter-spacing` using your browser's developer tools.)

Re: Emitting Safer Rust with C2Rust

#4

What problem does c2Rust solve exactly? Isn't it just gonna produce "garbage" rust. Calling c directly is already possible in rust.

This isn't about calling external C code from Rust; it helps people "rewrite" their C code in Rust.

You can debate the merits of doing so, of course, but some people do want to do that, and a tool to generate safe, somewhat idiomatic Rust from C code would seem to be useful.

Re: Emitting Safer Rust with C2Rust

#5

What problem does c2Rust solve exactly? Isn't it just gonna produce "garbage" rust. Calling c directly is already possible in rust.

From c2rust.com:

The C2Rust project is being developed by Galois and Immunant. This tool is able to translate most C modules into semantically equivalent Rust code. These modules are intended to be compiled in isolation in order to produce compatible object files. We are developing several tools that help transform the initial Rust sources into idiomatic Rust.

The translator focuses on supporting the C99 standard. C source code is parsed and typechecked using clang before being translated by our tool.

Re: Emitting Safer Rust with C2Rust

#7
C2rust is really cool, but if you're familiar with writing rust and implement even a trivial C function in there it produces something absolutely terrifying. I really enjoy rust and pray I don't find myself working in a code base someone just ran c2rust against.

Re: Emitting Safer Rust with C2Rust

#8

What problem does c2Rust solve exactly? Isn't it just gonna produce "garbage" rust. Calling c directly is already possible in rust.

From reading the article, I get that the latest version can transform some C into safe Rust.

This gains us machine-proved memory safety. This is huge.

Post reply on HN