You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/doc/book/mutability.md
+3-5
Original file line number
Diff line number
Diff line change
@@ -24,18 +24,16 @@ changed from one `i32` to another.
24
24
25
25
[vb]: variable-bindings.html
26
26
27
-
If you want to change what the binding points to, you’ll need a [mutable reference][mr]:
27
+
You can also create a [reference][ref] to it, using `&x`, but if you want to use the reference to change it, you will need a mutable reference:
28
28
29
29
```rust
30
30
letmutx=5;
31
31
lety=&mutx;
32
32
```
33
33
34
-
[mr]: references-and-borrowing.html
34
+
[ref]: references-and-borrowing.html
35
35
36
-
`y` is an immutable binding to a mutable reference, which means that you can’t
37
-
bind `y` to something else (`y = &mut z`), but you can mutate the thing that’s
38
-
bound to `y` (`*y = 5`). A subtle distinction.
36
+
`y` is an immutable binding to a mutable reference, which means that you can’t bind 'y' to something else (`y = &mut z`), but `y` can be used to bind `x` to something else (`*y = 5`). A subtle distinction.
0 commit comments