Conceptual
Login

Unsafe Rust

An unsafe block unlocks five extra powers (dereferencing raw pointers, calling unsafe functions, and others) but does not disable the borrow checker; the programmer takes over upholding the invariants the compiler can no longer verify. The contract: unsafe code must maintain safety invariants so that no safe caller can trigger undefined behavior, which is what makes safe abstractions over unsafe internals sound.

This Concept is waiting for its first lesson!

An unsafe block unlocks five extra powers (dereferencing raw pointers, calling unsafe functions, and others) but does not disable the borrow checker; the programmer takes over upholding the invariants the compiler can no longer verify. The contract: unsafe code must maintain safety invariants so that no safe caller can trigger undefined behavior, which is what makes safe abstractions over unsafe internals sound.

Are you a teacher? Sign in to start contributing.

Sign In