Unstable compilers
Unstable compilers
Posted Sep 25, 2024 9:52 UTC (Wed) by pbonzini (subscriber, #60935)In reply to: Unstable compilers by Wol
Parent article: Committing to Rust in the kernel
> it appears the Rust devs seem much more amenable to treating "you're optimising away necessary code" as a bug than the C folks were.
The optimization backend in the end is the same, the difference is that the language itself is designed to make it harder to trigger undefined behavior.
For example the level of aliasing is declared explicitly by separating shared and exclusive references (& and &mut). Developers can only turn a shared reference into an exclusive one via UnsafeCell (and then the code needs to be explicitly marked as unsafe) or wrappers thereof (which are carefully designed to avoid undefined behavior).
