- Immutable references (
&T
) allow read-only access. - Mutable references (
&mut T
) allow read-write access but are exclusive. - You cannot have mutable and immutable references to the same data simultaneously.
Lifetimes in Rust prevent dangling references by ensuring that references are always valid. The compiler checks lifetimes to guarantee that no references outlive the data they point to.