2 ms·
> "unsafe" by definition throws safety guarantees out the window I wish they had chosen a different keyword, it doesn't necessarily mean that. For instance, th
by leshow 8y ago
> "unsafe" by definition throws safety guarantees out the window
I wish they had chosen a different keyword, it doesn't necessarily mean that. For instance, the type checker still runs on the contents of unsafe blocks, so does the borrow checker, the only thing you can do that you can't normally is dereference raw pointers. This is potentially unsafe, and you should be careful, but it absolutely does not "throw all guarantees out the window".
- Nullabillity 8y ago> the only thing you can do that you can't normally is dereference raw pointers. The type checker still runs by default, but unsafe allows you to opt out of it selectively (with std::mem::transmute[0]). The same way that borrows are still checked, but unsafe allows you to opt out by using raw pointers (as you mentioned). [0]: https://doc.rust-lang.org/std/mem/fn.transmute.html https://doc.rust-lang.org/std/mem/fn.transmute.html