Closed lovelymono closed 2 years ago
thanks. As the person who wrote the section about Rust, I tried my best to write about it, but my knowledge is not very accurate. This section has been changed to more accurately reflect better information on Rust.
is incorrect, since
unsafe
doesn't allow disabling borrow checker. Rust compiler does not allow disabling borrow checker at all, ever. Only thingsunsafe
allows you to do is to dereference raw pointers, call unsafe functions, implement unsafe traits, mutate statics and access union fields^1. It still checks references inside unsafe blocks for validity.A better way would be to phrase it like so
Similarly, in section about pointers, technically Rust allows pointers everywhere, and only dereferencing them requires using unsafe.
Additionally, the syntax for mutable variables is incorrect: should be
mut x: int
instead ifx: mut int
.Then,
is wrong, as borrow checker only attempts to prevent memory-related bugs.