diff options
| author | bors <bors@rust-lang.org> | 2015-08-06 20:45:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-08-06 20:45:39 +0000 |
| commit | 68f79288bf1ac2b014277750cbf59416c91f7d04 (patch) | |
| tree | 9b84d43bdb83e0af17cf073dcacbc3efa98519fa | |
| parent | 11deb083f5bc3e57e73fc82de4bef7b1d4dad7b1 (diff) | |
| parent | d3e089f08bd55fc5e663400f513f77e567636628 (diff) | |
| download | rust-68f79288bf1ac2b014277750cbf59416c91f7d04.tar.gz rust-68f79288bf1ac2b014277750cbf59416c91f7d04.zip | |
Auto merge of #27566 - rubymeow:master, r=steveklabnik
I got a bit confused reading the guide over why all of a sudden there was an asterisk in the code. I was explained what it was there for in the IRC, and I think it should added it to the docs to prevent any further confusion!
| -rw-r--r-- | src/doc/trpl/references-and-borrowing.md | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/doc/trpl/references-and-borrowing.md b/src/doc/trpl/references-and-borrowing.md index d1d3063138e..a7a77539f79 100644 --- a/src/doc/trpl/references-and-borrowing.md +++ b/src/doc/trpl/references-and-borrowing.md @@ -125,6 +125,10 @@ This will print `6`. We make `y` a mutable reference to `x`, then add one to the thing `y` points at. You’ll notice that `x` had to be marked `mut` as well, if it wasn’t, we couldn’t take a mutable borrow to an immutable value. +You'll also notice we added an asterisk (`*`) in front of `y`, making it `*y`, +this is because `y` is an `&mut` reference. You'll also need to use them for +accessing the contents of a reference as well. + Otherwise, `&mut` references are just like references. There _is_ a large difference between the two, and how they interact, though. You can tell something is fishy in the above example, because we need that extra scope, with |
