We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← All tracks
0 / 4
Ownership II: Borrowing and the Borrow Checker
Rust`&`/`&mut` and aliasing XOR mutability. `.clone()` is withdrawn here — the training wheels come off. The borrow checker as a proof system, not a linter.
This track is written for Rust, which isn't the mode you're browsing in.
0
/ 21 solved
· 3 articles
- 1. Not solved yet. Move or borrow: the two ways to pass a value
- 2. Not solved yet. &mut: exclusive access, and why `mut` appears twice
- 3. Aliasing XOR mutability: the one rule Read
- 4. Not solved yet. How to read a borrow-check diagnostic
- 5. Not solved yet. Non-lexical lifetimes: a borrow ends at its last use
- 6. Not solved yet. E0502: cannot borrow as mutable because also borrowed as immutable
- 7. Not solved yet. E0499: cannot borrow as mutable more than once
- 8. Not solved yet. The owner is frozen too: E0503, E0505, E0506
- 9. Not solved yet. Slices are borrows
- 10. Not solved yet. &str not &String, &[T] not &Vec<T> — deref coercion and ptr_arg
- 11. Not solved yet. ref, ref mut, and default binding modes in edition 2024
- 12. Not solved yet. Iterator invalidation, and the bug class that stopped existing
- 13. Not solved yet. Indexing in a loop is usually a borrow-checker workaround — and clippy knows
- 14. Not solved yet. iter_mut(): mutating every element without ever holding two &mut
- 15. Not solved yet. Split borrows: the checker reasons about places, not variables
- 16. Not solved yet. split_at_mut and the disjointness-proof APIs
- 17. Not solved yet. Reborrowing: why &mut sometimes moves and sometimes doesn't
- 18. Not solved yet. Two-phase borrows: why v.push(v.len()) compiles
- 19. Not solved yet. What a &mut parameter actually promises
- 20. Not solved yet. NLL Problem Case #3, the entry API, and the limits of today's checker
- 21. Not solved yet. Closures hold their borrows
- 22. Not solved yet. Interior mutability: moving the check from compile time to run time
- 23. Why the rule exists: aliasing, noalias, and the optimizer Read
- 24. The borrow checker is a proof system, not a linter Read
Check yourself
4 questions · one attempt eachThese do not count toward finishing the track. They are here to catch the things that are easy to read past.
This pattern is famously rejected. Why?
fn get_or_insert(m: &mut HashMap<K, V>, k: K) -> &V {
if let Some(v) = m.get(&k) { return v; }
m.insert(k, V::default());
m.get(&k).unwrap()
}
Question 1 of 4