Skip to content

Commit d3d9bd0

Browse files
committed
Rollup merge of #33007 - notriddle:master, r=steveklabnik
Do not use "bind" to refer to both referencing and to assignment See https://users.rust-lang.org/t/difference-between-four-references/5406/7
2 parents 108a9e4 + 63b5080 commit d3d9bd0

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/doc/book/mutability.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,16 @@ changed from one `i32` to another.
2424

2525
[vb]: variable-bindings.html
2626

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:
2828

2929
```rust
3030
let mut x = 5;
3131
let y = &mut x;
3232
```
3333

34-
[mr]: references-and-borrowing.html
34+
[ref]: references-and-borrowing.html
3535

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.
3937

4038
Of course, if you need both:
4139

0 commit comments

Comments
 (0)