diff options
| author | Sandeep Datta <datta.sandeep@gmail.com> | 2016-02-17 20:47:24 +0530 |
|---|---|---|
| committer | Sandeep Datta <datta.sandeep@gmail.com> | 2016-02-17 20:47:24 +0530 |
| commit | 1536195ce66dcf764782e1f36ced4aa5eefef321 (patch) | |
| tree | d4b321621b8a825baf1fb7bdea1f84639bae2539 /src | |
| parent | 37a952a672ca79bfcc41795e378a710c196a557a (diff) | |
| download | rust-1536195ce66dcf764782e1f36ced4aa5eefef321.tar.gz rust-1536195ce66dcf764782e1f36ced4aa5eefef321.zip | |
Made v2 mutable so that we can actually truncate it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/book/ownership.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/doc/book/ownership.md b/src/doc/book/ownership.md index 3d67e20388b..ac6184013ee 100644 --- a/src/doc/book/ownership.md +++ b/src/doc/book/ownership.md @@ -139,7 +139,7 @@ Now consider the following code fragment: ```rust let v = vec![1, 2, 3]; -let v2 = v; +let mut v2 = v; ``` 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`: ```rust # let v = vec![1, 2, 3]; -# let v2 = v; +# let mut v2 = v; v2.truncate(2); ``` |
