4 ms·
Unsafe allows you to dereference raw pointers and foreign-function calls, but you cannot go around the borrow checker, which is what's causing annoyance. That
by jeeyoungk 9y ago
Unsafe allows you to dereference raw pointers and foreign-function calls, but you cannot go around the borrow checker, which is what's causing annoyance.
That said, you can create raw and dereference raw pointers, which lets you to do the above.
- vvanders 9y agoIf you take a ref into a pointer that lets you work around the borrow checker(and I've bitten myself just about every time I've done it now that I'm used to the borrow checker).
- wuch 9y agoUsing unsafe blocks and pointers can silence the borrow checker, but that doesn't mean that code is well defined. For example, using swap (mentioned in the article) with overlapping references would be undefined behaviour.