[1]: like when PyPI cryptography first switched to Rust and broke ansible/openwrt/etc.
We're just not there yet.
Still, looking at https://llvm.org/docs/CompilerWriterInfo.html, it is hard to find an architecture that Clang won't support that is relevant to many people. And if someone does find one, well, Clang is open source and open to adding more architectures.
* The kernel requires stability. Building a kernel w/ rustc is like building a house on a flying bullet.
* GCC is insanely good at porting to other architectures, something vendors have been relying on for a long long time.
* Consistency in applying compile flags and optimizations.
Idk, these are all I can think of right now.
Could you give some examples of big features from the last 12 months? I can’t think of any big ones off hand. IIRC, just a large number of small improvements.
> The kernel requires stability.
I can’t recall a new Rust release ever breaking existing code. Is this what you’re talking about?
> GCC
Rust will have a GCC backend and/or frontend soon.
> Consistency in applying compile flags and optimizations.
Can’t say much about this but I’m fairly sure the kernel devs won’t let anything be merged until they’re satisfied. We can trust them on this.
I have one case of code from late 2015 that stopped working in, IIRC, 2016, due to unsoundness being found in the borrow checker and it being fixed.
error[E0713]: borrow may still be in use when destructor runs
--> src/writer.rs:121:21
|
47 | impl<'a, F: Write + Read + Seek + 'a> Writer<'a, F> {
| -- lifetime `'a` defined here
...
121 | Reader::new(self.file)
| ------------^^^^^^^^^- returning this value requires that `*self.file` is borrowed for `'a`
122 | }
| - here, drop of `self` needs exclusive access to `*self.file`, because the type `Writer<'_, F>` implements the `Drop` trait
I ended up solving it by wrapping `self.file` in an "unnecessary" `Option` and using `Option::take` on `self.file` here. I guess I could have mucked around with `MaybeUninit` and risk UB instead, or removed the convenience `Drop` impl finalizer or made the impl non-generic.I haven't had a case of code no longer compiling since then.
> Could you give some examples of big features from the last 12 months? > ... > I can’t recall a new Rust release ever breaking existing code. Is this what you’re talking about?
Let me show you two links:
1. Rust version history: https://github.com/rust-lang/rust/blob/master/RELEASES.md
2. GCC changes: https://gcc.gnu.org/gcc-12/changes.html#c-family
Compared to Rust, GCC, the C compiler, is absolutely boring. The C language has been stable for decades, so there's hardly anything to be done on the language itself. GCC has been used in all kinds of occasions, and has compiled all types of applications and system software. We know it works in every situation. There's hardly anything to be done. This is how the real stability looks like - boring as shit.
Now, what, 12 months? The number isn't simply getting there.
That's a bewildering statement considering that one of the bells and whistles that Rust offers is memory safety.