5 ms·
Is there a Rust->C compiler? (I'm on phone or would check myself). That seems like it would provide the best of both worlds, no?
by Rotten194 11y ago
Is there a Rust->C compiler? (I'm on phone or would check myself). That seems like it would provide the best of both worlds, no?
- pygy_ 11y agoIf LLVM has a C backend, then yes, otherwise, no.
- mastax 11y agoLLVM had a c backened, it is no longer maintained. There was a project [1] to resurrect it but there hasn't been a commit in 11 months so I don't know the state of it. I've seen it come up a lot for various reasons related to rust so maybe someone will do the work. I think most of the reasons you'd want a C backened could be solved better just by extending the compiler, but not this case (closed source c-only utility). [1]:https://github.com/draperlaboratory/llvm-cbe https://github.com/draperlaboratory/llvm-cbe
- tavert 11y agoMaintained fork https://github.com/JuliaComputing/llvm-cbe https://github.com/JuliaComputing/llvm-cbe
- scott_s 11y agoBased on the cousin-comments in this thread, I don't think it would. Part of the benefits come from static analysis, but that static analysis uses annotations (such as for pre and post conditions) that the Rust to C compilation would not have.