1/6

The borrow checker enforces one rule: at any point, a value has either any number of shared references &T, or exactly one exclusive reference &mut T. Never both.

The part that trips people up is the phrase at any point. A borrow lasts until its last use, not until the end of the block. This is called NLL — non-lexical lifetimes — and it means most aliasing errors are fixed by moving a line, not by cloning.

let mut v = vec![1, 2, 3];
let first = &v[0];      // shared borrow starts
println!("{first}");    // ...and ends here, at its last use
v.push(4);              // fine — nothing is borrowing v any more