3 ms·
To elaborate on this: Rust always performs bounds checks on array accesses, so you can't get an out-of-bound read/write.
by shiftingleft 4y ago
To elaborate on this: Rust always performs bounds checks on array accesses, so you can't get an out-of-bound read/write.
- _8dej 4y agoIs there a way to turn this off?
- kibwen 4y agoNot via a compiler flag, no. The way to "opt out" of bounds checks is to replace `foo[bar]` with `unsafe { foo.get_unchecked(bar) }` at a given callsite. And the use of `unsafe` is going to immediately raise the eyebrow of any code reviewer or auditor.