Unsafe Rust
- Safe Rust: memory safe, no undefined behavior possible.
We will be seeing mostly safe Rust in this course, but it’s important to know what Unsafe Rust is.
Unsafe Rust gives you access to five new capabilities:
- Dereference raw pointers.
- Access fields.
- Implement traits.
Unsafe Rust does not mean the code is incorrect. It means that developers have turned off the compiler safety features and have to write correct code by themselves. It means the compiler no longer enforces Rust’s memory-safety rules.