Skip to content

Commit 1536195

Browse files
committed
Made v2 mutable so that we can actually truncate it.
1 parent 37a952a commit 1536195

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/doc/book/ownership.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Now consider the following code fragment:
139139
```rust
140140
let v = vec![1, 2, 3];
141141

142-
let v2 = v;
142+
let mut v2 = v;
143143
```
144144

145145
The first line allocates memory for the vector object `v` on the stack like
@@ -167,7 +167,7 @@ For example if we truncated the vector to just two elements through `v2`:
167167

168168
```rust
169169
# let v = vec![1, 2, 3];
170-
# let v2 = v;
170+
# let mut v2 = v;
171171
v2.truncate(2);
172172
```
173173

0 commit comments

Comments
 (0)