Rust can lend multiple shared &T references, but they cannot overlap an exclusive &mut T reference to the same value. This rule helps prevent data races and invalid references.
The demo enables two readers, then shows a conflict when a writer overlaps them. The actual borrow interval depends on the reference’s last use.
When to use
Pass references when a function needs to read or modify a value without taking ownership.