Now we can quickly re-rustify projects by converting them to C.
Rust to C compiler – 95.9% test pass rate, odd platforms
11–20 of 264 posts
Re: Rust to C compiler – 95.9% test pass rate, odd platforms
#12But does it carry the Rusty guarantees?
Re: Rust to C compiler – 95.9% test pass rate, odd platforms
#13Re: Rust to C compiler – 95.9% test pass rate, odd platforms
#14Re: Rust to C compiler – 95.9% test pass rate, odd platforms
#15Is it LLVM IR --> C? Or Rust AST to C?
> My representation of .NETs IR maps nicely to C, which means that I was able to add support for compiling Rust to C in 2-3K LOC. Almost all of the codebase is reused, with the C and .NET specific code only present in the very last stage of compilation
Re: Rust to C compiler – 95.9% test pass rate, odd platforms
#16How is this not dangerous? How can one be assured that all of the compile-time safety features of the Rust compiler are still in effect? Handwaving does not help.
Re: Rust to C compiler – 95.9% test pass rate, odd platforms
#17But does it carry the Rusty guarantees?
If the transpilation itself is bug-free, why not? For static guarantees, provided we transpile Rust code that already compiles on a normal Rust compiler, the guarantees are already checked and there, and the dynamic ones such as bounds checking can be implemented runtime in C with no problems.
Re: Rust to C compiler – 95.9% test pass rate, odd platforms
#18Very cool. C to Rust would be fantastic.
What benefit would you envision from this?
https://www.darpa.mil/news/2024/memory-safety-vulnerabilitie...
Re: Rust to C compiler – 95.9% test pass rate, odd platforms
#19Earlier quoted context omitted.
If the transpilation itself is bug-free, why not? For static guarantees, provided we transpile Rust code that already compiles on a normal Rust compiler, the guarantees are already checked and there, and the dynamic ones such as bounds checking can be implemented runtime in C with no problems.
this assumes the rusty guarantees are transitive. There's no reason to believe it isn't, but it'd be nice to see some sort of proof, or at least an argument for it.
Arguably it’s not the compiled binary that’s “safe”. It’s the code.
Re: Rust to C compiler – 95.9% test pass rate, odd platforms
#20How is this not dangerous? How can one be assured that all of the compile-time safety features of the Rust compiler are still in effect? Handwaving does not help.