204
DARPA suggests turning old C code automatically into Rust – using AI, of course
(www.theregister.com)
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities !webdev@programming.dev
c2rust: Am I a joke to you?
I threw some simple code at it and it even put
unsafe
on the main function, what's the point of Rust then if everything isunsafe
?For all of our sake, I hope humans are the final set of eyes before the code is used in prod.
And I hope that's not someone who doesn't understand the
static
keyword after 2+ years of C++ development.Ideally you don't directly ship the code it outputs, you use it instead of re-writing it from scratch and then slowly clean it up.
Like Mozilla used it for the initial port of qcms (the colour management library they wrote for Firefox), then slowly edited the code to be idiomatic rust code. Compare that to something like librsvg that did a function by function port
Baby steps. It's easier to convert code marked unsafe in Rust to not need unsafe than it is convert arbitrary code in other languages to Rust code that doesn't need unsafe.