Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/references/exclusive.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ fn main() {

Key points:

- "Exclusive" means that only this reference can be used to access the value. No
other references (shared or exclusive) can exist at the same time, and the
referenced value cannot be accessed while the exclusive reference exists. Try
making an `&point.0` or changing `point.0` while `x_coord` is alive.
- "Exclusive" means only this reference can access the value: no other reference
(shared or exclusive) may coexist. A borrow stays active until its last use,
not until the end of the scope, so to observe the restriction, add a
conflicting access before that last use — for example, read `&point.0` or
write to `point.0` on the line before `*x_coord = 20;`. Adding it after the
last use compiles, because the borrow has already ended.

- Be sure to note the difference between `let mut x_coord: &i32` and
`let x_coord: &mut i32`. The first one is a shared reference that can be bound
Expand Down
Loading