about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2016-03-01 13:39:42 -0500
committerSteve Klabnik <steve@steveklabnik.com>2016-03-01 13:39:42 -0500
commitc98c1b777fbe1a0c5ed74cd3de5a6b890da82974 (patch)
tree7b77e5dbc6af4f7817228e020c01a90383b5c28e
parent5b40e9b733f0609ee007982529bbf3bbe56862c5 (diff)
parentae9121bb6d4b83661792fc4772581970411b629c (diff)
downloadrust-c98c1b777fbe1a0c5ed74cd3de5a6b890da82974.tar.gz
rust-c98c1b777fbe1a0c5ed74cd3de5a6b890da82974.zip
Rollup merge of #31984 - xaocon:master, r=steveklabnik
Had a discussion at https://www.reddit.com/r/rust/comments/488mjv/borrowing_or_returning_ownership/ about how an example could be worded more clearly and tried to take my recommendation and expand upon it with further information provided in the post.
-rw-r--r--src/doc/book/references-and-borrowing.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/doc/book/references-and-borrowing.md b/src/doc/book/references-and-borrowing.md
index e7faf174600..0a4e09ed00a 100644
--- a/src/doc/book/references-and-borrowing.md
+++ b/src/doc/book/references-and-borrowing.md
@@ -211,9 +211,10 @@ fn main() {
 ```
 
 In other words, the mutable borrow is held through the rest of our example. What
-we want is for the mutable borrow to end _before_ we try to call `println!` and
-make an immutable borrow. In Rust, borrowing is tied to the scope that the
-borrow is valid for. And our scopes look like this:
+we want is for the mutable borrow by `y` to end so that the resource can be
+returned to the owner, `x`. `x` can then provide a mutable borrow to `println!`.
+In Rust, borrowing is tied to the scope that the borrow is valid for. And our
+scopes look like this:
 
 ```rust,ignore
 let mut x = 5;
@@ -378,4 +379,3 @@ statement 1 at 3:14
 
 In the above example, `y` is declared before `x`, meaning that `y` lives longer
 than `x`, which is not allowed.
-