Skip to content

Commit

Permalink
ch15-02-deref: Fix explanation on immut-to-mut
Browse files Browse the repository at this point in the history
On a hypothetical immut-to-mut deref, the resulting mut ref should be
unique. The aliasing rules say the mutable reference should be the only
reference, so correct the language accordingly.

Signed-off-by: Eddy Petrișor <eddy.petrisor@gmail.com>
  • Loading branch information
eddyp committed Jul 13, 2019
1 parent f643a97 commit 2cfe277
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ch15-02-deref.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,6 @@ a mutable reference, that mutable reference must be the only reference to that
data (otherwise, the program wouldn’t compile). Converting one mutable
reference to one immutable reference will never break the borrowing rules.
Converting an immutable reference to a mutable reference would require that
there is only one immutable reference to that data, and the borrowing rules
there is only one mutable reference to that data, and the borrowing rules
don’t guarantee that. Therefore, Rust can’t make the assumption that converting
an immutable reference to a mutable reference is possible.

0 comments on commit 2cfe277

Please sign in to comment.