about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRuby <hi@ruby.sh>2015-08-06 19:29:03 +0100
committerRuby <hi@ruby.sh>2015-08-06 19:29:03 +0100
commit855f1ff3215e76d438783d8bdf743d6cb641ff89 (patch)
treeba2cb1080cb5e1577cf05c7f3a1d3496f461df24 /src
parent8f3901feabf6c9072e533ae69b14b5761909f642 (diff)
downloadrust-855f1ff3215e76d438783d8bdf743d6cb641ff89.tar.gz
rust-855f1ff3215e76d438783d8bdf743d6cb641ff89.zip
Explained asterisk on & and &mut reference
Diffstat (limited to 'src')
-rw-r--r--src/doc/trpl/references-and-borrowing.md4
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..1709ac8f26b 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 and modifying `&` references 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