4 ms·
Because there is often some confusion, note that there are two different projects in this space with different approaches. The project discussed in the video a
by kibwen 4y ago
Because there is often some confusion, note that there are two different projects in this space with different approaches.
The project discussed in the video above is a new front end to GCC (written in C++, as is typical for GCC frontends) and is developed here: https://github.com/Rust-GCC/gccrs https://github.com/Rust-GCC/gccrs
The other project involves plugging GCC's backend into the existing rustc frontend, and is developed here: https://github.com/rust-lang/rustc_codegen_gcc https://github.com/rust-lang/rustc_codegen_gcc
Both projects intend to eventually allow Rust code to make use of GCC. But they will likely appeal to different sets of users: the former project appeals to people invested in the GCC ecosystem who want to use Rust without installing a whole separate toolchain, and the latter to people invested in the Rust ecosystem who want to benefit from GCC's broader target support.
- dannymi 4y agoAnd then there's mrustc https://github.com/thepowersgang/mrustc https://github.com/thepowersgang/mrustc , a Rust compiler written in C++, using LLVM.
- CohenArthur 4y agoIt's important to note that mrustc is not intended for everyday use and instead as a bootstrap compiler for rustc (at least originally). We would like to develop an alternative that is suitable as a daily rust compiler and that integrates into the existing Rust ecosystem (and makes use of it!)
- kzrdude 4y agoThat's claimed for two reasons - bootstrapping is the first milestone of a working and useful rust compiler. In this case; if it couldn't be used for anything else, at least it could do that. It's also claimed that "it will only be that" to seem more non-threatening to the main Rustc project. If it was “easy” to do, mrustc would of course support all of the Rust language. Maybe it will get there if there is enough work and interest. There was this vague concern about splitting the ecosystem. The concern is understandable - to an ecosystem that has been "in control" by a central implementation for a decade. I would file it under growing pains. Rust can't, when it grows up, always be a single-implementation language.
- hvdijk 4y agoYou're saying the project's maintainer is deliberately misrepresenting mrustc's goals in order to prevent malicious interference by the Rust community? Both of those seem very unlikely to me and I can't see anything in your message to provide support for those claims. I see no reason not to just take things at face value here.
- kzrdude 4y agoIn fact the project itself doesn't claim it will only be that. But in the community, this idea is still spread around.
- kibwen 4y agoRather than being afraid of interference, the reason that the mrustc author is so careful in their wording is that nobody has ever bothered to define what it means to be a "compatible" implementation of Rust, which is a semantic and legal hurdle that the implementation in the OP will have to clear. In a more concrete sense, mrustc can't currently be a compatible implementation of Rust, because (by dint of lacking a borrow Checker) it accepts more programs than rustc does (arguably it's fine to accept strictly fewer programs than rustc does and still be called a compatible implementation).
- dodobirdlord 4y agoNotably, mrustc is a Rust compiler in the sense that it is able to compile valid Rust code. It does not provide a guarantee that it will reject invalid input. The user is on the hook to work out themselves through some other mechanism that their code is valid before calling mrustc. This is fine for a project with the goal of providing an alternative bootstrapping path for rustc. The rustc codebase is known to be valid Rust, more or less by definition, since rustc is self-hosting and Rust is defined by rustc’s implementation rather than by a specification.
- fulafel 4y agoThe mrustc page says: > This project is a "simple" rust compiler written in C++ that is able to bootstrap a "recent" rustc, but may eventually become a full separate re-implementation. So it's a compatible statement to say that it's currently a bootstrap compiler.
- est31 4y ago> a Rust compiler written in C++, using LLVM. FTR mrustc does not use LLVM, it compiles to C, which is then compiled using a C11 compatible compiler. So it can "make use of LLVM" through clang for that last step, but that's not usually what people mean when they say that some project uses LLVM.
- rapsey 4y agoAs well as a cranelift backend https://github.com/bjorn3/rustc_codegen_cranelift https://github.com/bjorn3/rustc_codegen_cranelift
- woodrowbarlow 4y agobut doesn't rustc already use llvm as its backend?
- kibwen 4y agoIt does, but the rustc frontend is capable of supporting several backends, and different backends offer different features (e.g. compilation speed, code quality, platform support).