Skip to content

Commit 3e76f28

Browse files
committed
v2 gets a copy of the pointer, not a copy of the data
1 parent 84c7dfa commit 3e76f28

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/doc/trpl/ownership.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ let v2 = v;
123123

124124
The first line creates some data for the vector on the [stack][sh], `v`. The
125125
vector’s data, however, is stored on the [heap][sh], and so it contains a
126-
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,
127127
for `v2`. Which would mean two pointers to the contents of the vector on the
128128
heap. That would be a problem: it would violate Rust’s safety guarantees by
129129
introducing a data race. Therefore, Rust forbids using `v` after we’ve done the

0 commit comments

Comments
 (0)