Back to course

Unsafe Rust: When to Use It

Rust for Systems & Web3 Security

Stepping Outside the Safety Net

Sometimes you need to perform actions the compiler cannot guarantee are safe, like dereferencing raw pointers or calling C functions. You use the unsafe keyword.

Warning: 99% of the time, you don't need unsafe. In Web3, unsafe is often banned in Smart Contracts because it bypasses the security guarantees of the language.