4 ms·
IMO differentiating a specification and reference this way is just nitpicking. However it looks like that at least unsafe rust is underspecified regarding alia
by planede 4y ago
IMO differentiating a specification and reference this way is just nitpicking.
However it looks like that at least unsafe rust is underspecified regarding aliasing rules, therefore a bunch of unsafe rust is undefined behavior by definition. That is no authoritative text (whether reference or specification) defines the behavior of those programs.
Key paragraph from the article:
> Stacked Borrows is not part of the Rust spec, and is not the final word for aliasing-related UB in Rust. So there is still the chance that future revisions of this model can be made to better align with programmer intuition. The above code might get accepted because x2 is not actually being used to access memory. Or maybe &mut expr should only make such promises when used outside an unsafe block — but then, should adding unsafe really change the semantics of the program? As usual, language design is a game of trade-offs.