Announcement

Collapse
No announcement yet.

Should GNOME Begin Replacing More C Code With Rust?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #91
    Originally posted by mmstick View Post
    There is the no GCC backend for Rust, and as far as I know, there never will be, nor should anyone waste their time writing one. Rust's libcore is deeply integrated with LLVM primitives, and the language makes extensive use of LLVM compiler plugins. Therefore, it does not make sense to waste time developing a GCC backend, as GCC will never have support for compiler plugins due to poor design decisions by the GNU developers, and it's usefulness is very limited in comparison to LLVM, which is a more capable tool. Any target that LLVM supports, Rust supports. Rust is even compiling for the web with WASM.
    Rust isn't intended to be dependent on LLVM. In fact, there' currently discussion about adding support to generate Cretonne IR rather than LLVM IR for WASM and debug-mode compiles.

    (Cretonne is an in-development WASM code generator backend for Firefox's SpiderMonkey JS engine so they can eliminate C-inspired undefined behaviour at the LLVM IR level and optimize for compile time constraints in a web context. Both of those would fit well alongside things like "Rust debug builds turn on the too-heavy-for-release guards for integer over/underflow" so that Cretonne and LLVM would take up roles similar to the C/C++ "do debug builds with Clang for the superior analysis, do release builds with GCC for maximum performance" pattern.)

    As for GCC, the following three lines have already shown up in that thread:

    It will help us validate that Rust is independent from LLV
    I agree that it's important to not tie a system language too much to a single back-end. How about also using the GCC back-end?
    I am a GCC contributor, if there's interest in a GCC backend I would be able to help. Although, I must say, I know little of Rust at this point so I wouldn't be able to carry this project forward by myself. Someone with a deep knowledge of Rust would need to mentor.

    Comment

    Working...
    X