Re:Translating Quake 3 into Rust
by steveklabnik on Tuesday January 07, 2020 @10:04AM
(#21980530)
Their plan is twofold, in my understanding: first to translate the code fairly literaly, and then second, to provide unsafe -> safe refactoring tools. As far as I know they’re still on step 1.
Re:Translating Quake 3 into Rust
by harpocrates on Tuesday January 07, 2020 @10:51AM
(#21981080)
Step 2 has been happening concurrently, and pretty much since the start of the project. See https://github.com/immunant/c2rust/tree/master/c2rust-refact.... It is just a lot tougher to get right, so it gets less publicity.
Re:Translating Quake 3 into Rust
by steveklabnik on Tuesday January 07, 2020 @10:57AM
(#21981134)
Ah awesome! Thanks for the link.
Cool, that seems like a very sensible approach. The fact that they are already uncovering memory issues in C is promising too.
Re:Translating Quake 3 into Rust
by steveklabnik on Tuesday January 07, 2020 @10:08AM
(#21980579)
Yep, I think so too. That example output is more verbose than a human would write, but it’s a sensible start.
Re:Translating Quake 3 into Rust
by mikepurvis on Tuesday January 07, 2020 @02:36PM
(#21983819)
Looks like it's meant to enable projects similar to how the Go compiler/toolchain was initially translated (with the like-named c2go) and then gradually rewritten over time into idiomatic golang. It's easy to see that this could be a much more tenable project then a grand rewrite that has two codebases iterating forward in parallel for a time.
The fact that they found a memory safety bug is excellent. Maybe translating old C projects to Rust via this method can be used to find memory issues as well as to aid rewriting in Rust projects.
EDIT: You can try the transpilation yourself on https://c2rust.com/
Here's an example of the output: