The three ownership rules
Every value has a single owner. When the owner goes out of scope, the value is dropped. Ownership can be transferred (moved) by assignment or function call. These three rules eliminate use-after-free and double-free bugs at compile time.
For deeper background, see the canonical Rust learning roadmap for the broader context behind this section.
References and borrowing
Instead of moving ownership, you can borrow a value. `&T` is a shared reference, `&mut T` is an exclusive mutable reference. The compiler enforces that you cannot have both at once on the same value, which prevents data races at compile time.
Lifetimes
A lifetime annotation like `'a` tells the compiler how long a reference is valid. Most lifetimes are inferred — you only annotate when the compiler cannot work out the relationship between input and output references on its own.
Smart pointers
When the ownership rules feel restrictive, smart pointers like Box, Rc, and RefCell give you controlled escape hatches. Use them deliberately — they trade compile-time guarantees for runtime checks.