External Publication
Visit Post

Reducing Raw Pointer Footguns: Preventing Reference Aliasing Violations at Compile Time

Rust Internals [Unofficial] May 17, 2026
Source

One powerful escape hatch is “you can take the mutable/immutable reference in the guard’s callback and do anything you could do to a normal mutable reference, within that scope, including mixing raw pointers and references”. The callback could be arbitrarily complicated, potentially the equivalent of a full fn main.

This would be an utterly ineffective use of the guard which I don’t thing anybody would want to do, but still possible.

Discussion in the ATmosphere

Loading comments...