Reducing Raw Pointer Footguns: Preventing Reference Aliasing Violations at Compile Time
Rust Internals [Unofficial]
May 17, 2026
fuji-184:
But regardless of what you think about it, I need some clear technical feedback,
Let me provide a specific technical claim: AliasingGuardMut's intended property is trivially defeatable. Nothing prevents this, which is the kind of mixing that you want to prevent:
let ptr = guard.with_mutable_pointer(|ptr| ptr);
guard.with_mutable_reference(|r| {
// do something with `r` and `ptr` here
});
This means that, if AliasingGuardMut provides value, the value will be in the subjective realm of “using this type as intended will help people make fewer mistakes”.
Discussion in the ATmosphere