Skip to content

Commit

Permalink
v2 gets a copy of the pointer, not a copy of the data
Browse files Browse the repository at this point in the history
  • Loading branch information
simonkern committed May 7, 2015
1 parent 84c7dfa commit 3e76f28
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/doc/trpl/ownership.md
Expand Up @@ -123,7 +123,7 @@ let v2 = v;

The first line creates some data for the vector on the [stack][sh], `v`. The
vector’s data, however, is stored on the [heap][sh], and so it contains a
pointer to that data. When we move `v` to `v2`, it creates a copy of that data,
pointer to that data. When we move `v` to `v2`, it creates a copy of that pointer,
for `v2`. Which would mean two pointers to the contents of the vector on the
heap. That would be a problem: it would violate Rust’s safety guarantees by
introducing a data race. Therefore, Rust forbids using `v` after we’ve done the
Expand Down

0 comments on commit 3e76f28

Please sign in to comment.