Conversation

Replying to
There were literally dozens of bugs uncovered in LLVM as part of trying to fix this for Rust. It's also incredibly broken in GCC and it isn't getting fixed there because this incentive doesn't exist. Using restrict is probably a bad idea with either, especially combined with LTO.
1
2
Replying to and
I don't remember the precise rules for restrict off the top of my head, but for noalias in LLVM, it can also largely be applied to immutable references in Rust because it's really about memory dependencies and Rust can track when types have 'internal mutability' via Cell, etc.
1
1
Replying to and
Since immutable references in Rust actually mean immutable, not an immutable view of something mutable. The exception is if it uses a form of internal mutability (Cell, RefCell) and those safe abstractions need to be implemented via UnsafeCell so the compiler can be fully aware.