The Borrow Checker Mental Model
Rust replaces garbage collection and manual memory management with a single compile-time invariant:
- Each value in Rust has an owner.
- There can only be one owner at a time.
- When the owner goes out of scope, the value is dropped.
Aliasing XOR Mutability
You may have either:
- Any number of immutable references (
&T), OR - Exactly one mutable reference (
&mut T).
Personal engineering field notes compiled from production systems. Patterns and benchmarks are updated as runtimes evolve.