|
3 | 3 | This guide is one of three presenting Rust’s ownership system. This is one of
|
4 | 4 | Rust’s most unique and compelling features, with which Rust developers should
|
5 | 5 | become quite acquainted. Ownership is how Rust achieves its largest goal,
|
6 |
| -memory safety. The there are a few distinct concepts, each with its own |
| 6 | +memory safety. There are a few distinct concepts, each with its own |
7 | 7 | chapter:
|
8 | 8 |
|
9 | 9 | * ownership, which you’re reading now.
|
@@ -59,6 +59,7 @@ deterministically, at the end of the scope.
|
59 | 59 |
|
60 | 60 | [vect]: ../std/vec/struct.Vec.html
|
61 | 61 | [heap]: the-stack-and-the-heap.html
|
| 62 | +[bindings]: variable-bindings.html |
62 | 63 |
|
63 | 64 | # Move semantics
|
64 | 65 |
|
@@ -122,7 +123,7 @@ let v2 = v;
|
122 | 123 |
|
123 | 124 | The first line creates some data for the vector on the [stack][sh], `v`. The
|
124 | 125 | vector’s data, however, is stored on the [heap][sh], and so it contains a
|
125 |
| -pointer to that data. When we move `v` to `v2`, it creates a copy of that data, |
| 126 | +pointer to that data. When we move `v` to `v2`, it creates a copy of that pointer, |
126 | 127 | for `v2`. Which would mean two pointers to the contents of the vector on the
|
127 | 128 | heap. That would be a problem: it would violate Rust’s safety guarantees by
|
128 | 129 | introducing a data race. Therefore, Rust forbids using `v` after we’ve done the
|
|
0 commit comments