3 ms·
The grandparent is wrong. Unsafe doesn't disable safety functions. From the big book of Rust Unsafety: The only things that are different in Unsafe Rust are th
by Ygg2 6y ago
The grandparent is wrong. Unsafe doesn't disable safety functions. From the big book of Rust Unsafety:
The only things that are different in Unsafe Rust are that you can:
- Dereference raw pointers
- Call unsafe functions (including C functions, compiler intrinsics, and the raw allocator)
- Implement unsafe traits
- Mutate statics
- Access fields of unions
https://doc.rust-lang.org/stable/nomicon/what-unsafe-does.html https://doc.rust-lang.org/stable/nomicon/what-unsafe-does.ht...
The point is, unsafely calling `get_unchecked` is what's bypassing the range check feature. Not Unsafe itself.