Rust Ownership & Borrow Checker Language Collocations
Practise the standard verbs for working with Rust's ownership and borrowing model.
0 / 5 completed
1 / 5
Fill in: 'We ___ ownership of a value explicitly to a function so the caller can no longer use it afterward, rather than relying on an implicit shared reference.'
We 'transfer ownership' — the standard, established Rust collocation for moving a value so only one binding owns it. The other options aren't the recognised term here.
2 / 5
Fill in: 'Holding a mutable reference alongside an active immutable one can ___ the borrow checker rejecting code that would otherwise compile fine in most other languages.'
We say overlapping borrows will 'leave' the compiler rejecting the code — the standard, natural collocation for the resulting error. The other options aren't idiomatic here.
3 / 5
Fill in: 'We ___ a lifetime annotation explicitly on a struct holding a reference, so the compiler can verify the reference never outlives the data it points to.'
We 'add an annotation' — the standard, simple collocation for attaching lifetime information to a type definition. The other options are less idiomatic here.
4 / 5
Fill in: 'We ___ a value's ownership with Rc when several parts of the program genuinely need shared access, rather than fighting the borrow checker with unsafe workarounds.'
We 'share ownership' — the standard, simple collocation for using reference counting to allow multiple owners. The other options are less idiomatic here.
5 / 5
Fill in: 'We ___ every borrow checker error message carefully before reaching for unsafe, since the compiler is usually flagging a real aliasing bug rather than being overly strict.'
We 'read' an error message — the standard, simple collocation for examining compiler diagnostics before acting on them. The other options are less idiomatic here.