Skip to content

Commit

Permalink
ch15-02-deref: Improve explanation on immut-to-mut (#2030)
Browse files Browse the repository at this point in the history
ch15-02-deref: Improve explanation on immut-to-mut
  • Loading branch information
carols10cents committed Jan 27, 2020
2 parents f5a00f4 + f7663d1 commit 13a8359
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ch15-02-deref.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ never coerce to mutable references. Because of the borrowing rules, if you have
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
don’t guarantee that. Therefore, Rust can’t make the assumption that converting
an immutable reference to a mutable reference is possible.
Converting an immutable reference to a mutable reference would require that the
initial immutable reference is the only immutable reference to that data, but
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 13a8359

Please sign in to comment.