GCC Rust Monthly Report #6 May 2021
thephilbert.io
thephilbert.io
let string = String::from("something");
// string.len() doesn't work in GDB
Debuggin rust still involves a lot of println! or debug!I thought it was pretty interesting, though based on the reddit comments (https://reddit.com/r/rust/comments/noby1t/the_simpler_altern...) the main concern seems to be if a second Rust is implemented without a spec, it could lead to subtle incompatibilities?
Every time gcc-rs comes up, the discussion always devolves to a "but there's rustc_codegen_gcc, why bother rewriting the language in C++", and I have yet to see a compelling argument why GCC-RS is indeed a superior solution, despite the many downsides.
I think the answer is that it isn't necessarily a better solution, but the people with the necessary knowledge to make a gcc frontend or backend happen tend to be more familiar with C++, and so GCC-rs is actually the path of least resistance?
I am not saying that the project is above criticism, or that there are no downsides to its approach, but this article isn’t interested in dispassionate engineering analysis.
I personally think that's a good thing that multiple approaches to the problem exist and in the end, the better one will hopefully be adopted by the community.
Or both. I mean, is there anything wrong with having multiple implementations of a language?
They may each be better for different reasons.
Anyways, their loss, not mine.
Until Rust gets a real standard it will forever be a toy language. For many (most?) people in the systems programming sphere (including me) the lack of a standard is the #1 impediment to using Rust.
Do you know if there's been one that I've missed?
Some of the work involved in producing a specification will involve making decisions about corner cases which aren't currently nailed down. What I'm wondering is whether the Ferrocene people are going to be effectively authorised to make those decisions.
https://ferrous-systems.com/blog/sealed-rust-the-pitch/#fund...
And clashes with the entire development of the Rust language so far.
But looking at https://foundation.rust-lang.org/ I see a content-devoid site that holds nothing but passive-aggressive demands for money.
That's about as far away from "firmly believing" as possible given the circumstance.
Good specs don't emerge from thin air (though I suspect that many bad specs emerge through spontaneous generation), and the people who work on them deserve to be funded. While I'm not claiming the process the Rust community has is perfect, it is explicitly designed to be sustainable, and I think it's right to be proud of the collaboration between different companies, large and small, and also academia; Ralf Jung's work in particular is foundational and he well earned his recent PhD for it.
It's a relatively new project, and will take time to catch up to existing languages in many areas.
Neither C or C++ started with a standard.
Regardless, it is a misunderstanding of Rust’s governance to suggest that the Foundation would lead a standardization effort; the Language Team, part of the Project, not the Foundation, is in charge of the definition of the language.
The official compiler has an LLVM backend. GNU also wants to provide rust, and is adding a rust front to their gcc compiler.
These monthly reports document the progress until the gcc compiler reaches feature parity with the LLVM-based compiler
What is the second rust compiler?
"mrustc's primary goal is bootstrapping rustc, and as such it tends to assume that the code it's compiling is valid (and any errors in the generated code are mrustc bugs). Code generation is done by emitting a high-level assembly (currently very ugly C, but LLVM/cretone/GIMPLE/... could work) and getting an external tool (i.e. gcc) to do the heavy-lifting of optimising and machine code generation."
At least it can be used to bootstrap the actual rust compiler. It's a bit crazy to me how popular this language appears to be, but doesn't have a proper second compiler yet.
* Compiler docs: https://rustc-dev-guide.rust-lang.org/mir/optimizations.html
* Working Group: https://rust-lang.github.io/compiler-team/working-groups/mir...
* Example of one such optimization, "constant propagation" https://blog.rust-lang.org/inside-rust/2019/12/02/const-prop...
GCC has an IR called GIMPLE that’s fine.
Certainly quite a bit of rustc could be cannibalized? Surely the parsing, type, and borrow checking stage or perhaps all the way to the m.i.r. could have been shared.
On the practical level, rustc is written in rust and self-hosting, so reusing code from it in gcc would mean that you needed a rust compiler as well as a c compiler to compile gcc.
Also, rustc and gcc have incompatible licenses.
I see, they want a full Rust implementation written in C++ rather than in Rust?
There is another project pursuing that approach. Both are valid strategies with different pros and cons.