News for hackers. Stuff that matters.
Re:Incrementing vectors by comex on Tuesday August 27, 2019 @02:14AM (#20806761)
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

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.

There are no comments on this comment yet.