Rust theorytheory 0/50 · 0%
Ownership · easy

8. Borrowing

References read data without owning it.

`&T` is a shared borrow, `&mut T` an exclusive one. You may have many shared borrows or exactly one mutable borrow, never both at once. The borrow checker enforces this at compile time, removing data races and use-after-free without a garbage collector.

Check your understanding

  1. 1. How many mutable borrows may coexist?

  2. 2. May a shared and mutable borrow overlap?