|
|
|
|
|
by steveklabnik
3297 days ago
|
|
> Is it the case that "unsafe" tells the compiler to not perform its memory safety checks on that section of code, So, unsafe Rust is a superset of safe Rust. Adding `unsafe` around some code lets you do four things: * Dereferencing a raw pointer * Calling an unsafe function or method * Accessing or modifying a mutable static variable * Implementing an unsafe trait That's it. Nothing else changes, you get these additional abilities. This is very important, conceptually. Tons of other checks are still on, etc. With that in mind, > (What would happen if you put only code that could be verified by the compiler in an unsafe block?) It would function identically. |
|