Borrow Checker
The Rust borrow checker verifies reference rules at compile time: immutable and mutable references cannot coexist, and the mutable reference must be unique.
Purpose
Eliminate data races and dangling references at compile time — the core of Rust's memory safety.
Mechanism
Rules: 1) any number of immutable references, or 2) a single mutable reference — never both at once. References must not outlive the data's lifetime. Violations fail compilation rather than causing runtime errors. NLL (non-lexical lifetimes) relaxes the restrictions.
Use cases
- Rust programming
- Memory safety
- Concurrency safety