2 ms·
> ("unsafe { myvec[0] }") Part of the point in my post is that this does not remove the bounds check. This unsafe block does nothing. This actually might be a
by steveklabnik 8y ago
> ("unsafe { myvec[0] }")
Part of the point in my post is that this does not remove the bounds check. This unsafe block does nothing.
This actually might be a better example than the one I picked...
- kibwen 8y agoAnd just as in the OP, the compiler makes it clear that this unsafe block does nothing: warning: unnecessary `unsafe` block --> src/main.rs:4:3 | 4 | unsafe { myvec[0]; } | ^^^^^^ unnecessary `unsafe` block |