External Publication
Visit Post

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

Rust Internals [Unofficial] May 17, 2026
Source
I remember that survey, but I forgot whether it included running Clippy or not. But in my daily use case, I do not run Clippy :[ I run it previously using the Clippy command to auto fix, and the result wasn't what I expected then I don't use it again. Maybe the safest usage of it is the Clippy check command to only give messages not edit I think there is a reason why this was implemented in Miri instead of Clippy. Maybe, within Clippy’s context, it is not possible to accurately prove aliasing rule violations? That is an imagination based concern that does not apply here, because we can still opt out of the guard checks simply by writing code outside the guard’s scope If Miri were already sufficient, then we probably would not still see aliasing rule UB in Rust projects. Miri runs at runtime, which means every problematic code path must actually be executed, usually through tests. The tests must trigger every piece of code that could potentially violate aliasing rules, and that is exactly where human error comes in, some violations slip through simply because nobody realized that the code violated aliasing rules. And when the codebase becomes large, the number of tests required to trigger all those checks also increases. If the code gets refactored, the tests also need to be refactored so they still execute the relevant paths and trigger the checks. Human error in failing to trigger every problematic path is what allows aliasing related UB to slip through Anyway, do you have any technical feedback? For example, what kinds of code would not work with this guard?

Discussion in the ATmosphere

Loading comments...