3 ms·
Statically eliminating array bounds violations is definitely something Rust doesn't do.
by andrewflnr 9y ago
Statically eliminating array bounds violations is definitely something Rust doesn't do.
- kibwen 9y agoNot Rust, though it is something that LLVM does will do to Rust code, quite often.
- andrewflnr 9y agoSure, but that's not something you can rely on, is it?
- kibwen 9y agoIt's just an optimization, so obviously it's not guaranteed, but that doesn't mean it's random. And if it's in your hot loop and not being optimized away, benchmarking will find it easily. At the same time, array indexing in Rust is vanishingly rare IME... turns out I only ever used it for `for` loops, which are better served by iterators. :P