(I’ve been thinking about this topic “Rust support in GCC” for a few months, but have never been able to dedicate a big-enough amount of time to it…)
As long as the Rust programming language is not properly specified, I suppose writing a new front end is too big of a task: that basically means having to chase upstream Rust changes continuously. (That is, unless such an effort were absolutely backed by the current Rust stakeholders, on all relevant levels: developers, language maintainers, management.) So, to me, as a pragmatic engineer, re-using the existing Rust front end is the only feasible option right now, to add “Rust support in GCC”.
@dmalcolm’s libgccjit has been suggested, and I can additionally/alternatively see the following option: the current Rust front end certainly must be generating some intermediate language (pure LLVM IR, or some variant thereof?). Assuming this IL is reasonably stable, we could write a GCC front end for that instead of a front end for the evolving Rust programming language. (In a way, similar to the BRIG/HSAIL front end that has recently been contributed to GCC, for example.)
Such a GCC front end for LLVM IR might have appeal in its own right – alternatively, some might find it disgusting
– for there are also other languages nowadays that are not supported in GCC but for which LLVM-based front ends exist.
(I have not yet looked into any potential licensing issues, but I don’t really expect any, if interoperating at the IL level.)
Unfortunately, it’s unlikely that I’ll be able to dedicate a major amount of time to such a task. :-/