It would be cool to convert a unix userland to rust (sbase? toybox?)
Announcement
Collapse
No announcement yet.
Corrode Making Progress On Translating C To Rust
Collapse
X
-
If it were possible to automatically convert a C code to the Rust, there would be no need in the Rust at all. The Rust allows to specify an additional information about who owns resources and who and how accesses these resources. If you have some tool that can extract this information from more or less sophisticated C code, there is no point to convert anything to the Rust, you can just use a part of this converter as a statical analyzer.
Comment
-
Originally posted by ssokolow View Post
There are two parts to translating a codebase from one language to another: Ensuring equivalent functionality, and then rewriting to match the language idioms.
This helps to eliminate human error during the first one so new bugs don't creep in there.
It won't automatically fix all the bugs - but it *will* likely find quite a lot of them, because many of those bugs will be caught either by Corrode itself, of by Corrode generating code which the Rust compiler will reject. And once done, the resulting code can be manually improved to be idomatic Rust (instead of C-in-Rust), without fear of introducing all those types of bugs which C is susceptible to, and which Rust is not.
- Likes 1
Comment
-
Originally posted by speculatrix View PostNext, a tool to convert Rust code to C for performance reasons.. write your program and test in Rust, to prove it's good, then convert to make it run fast.
Only half kidding.
- Likes 1
Comment
-
Originally posted by ssokolow View Post
There are two parts to translating a codebase from one language to another: Ensuring equivalent functionality, and then rewriting to match the language idioms.
This helps to eliminate human error during the first one so new bugs don't creep in there.
- Likes 1
Comment
-
Originally posted by ravyne View PostPrecisely this. What that buys you is that you get a verbatim machine-translation of C to Rust, which you can then rig for unit-tests using Rust's frameworks before you begin to refactor towards idiomatic rust to make sure the refactoring doesn't introduce errors.
Comment
Comment