3 ms·
Rust has no type-based aliasing restrictions at all. However, it does require references to be either unique or read-only, which means that it can automaticall
by comex 7y ago
Rust has no type-based aliasing restrictions at all. However, it does require references to be either unique or read-only, which means that it can automatically treat them as noalias (LLVM equivalent of __restrict). Unfortunately, this feature is disabled due to an LLVM bug:
https://github.com/rust-lang/rust/issues/54878 https://github.com/rust-lang/rust/issues/54878
On the other hand, if you use the more idiomatic `&mut [u8]`, that passes the pointer and size by value, so it should avoid the issue.
Edit: Using an iterator also avoids the problem, unlike in C++, because Rust iterators store their bounds within the iterator itself rather than calling iterable.end() on each iteration.