diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2016-06-07 10:43:58 -0400 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2016-06-07 10:43:58 -0400 |
| commit | 3ff22ccd40e9405f013a807d6c00d3995731116d (patch) | |
| tree | 4224670be91fc8703995daf832a9c675a079d39f | |
| parent | 814f685df21439ab6eab83f421d4b60cab026a0b (diff) | |
| parent | f07aa355495ee4028ea3a3513737f90f9f4146e1 (diff) | |
| download | rust-3ff22ccd40e9405f013a807d6c00d3995731116d.tar.gz rust-3ff22ccd40e9405f013a807d6c00d3995731116d.zip | |
Rollup merge of #34125 - MichaelNecio:book_addition, r=steveklabnik
Noted that shadowing never destroys a value Fixes issue #33887 r? @steveklabnik
| -rw-r--r-- | src/doc/book/variable-bindings.md | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/doc/book/variable-bindings.md b/src/doc/book/variable-bindings.md index dc50299f5f3..b6751f57a97 100644 --- a/src/doc/book/variable-bindings.md +++ b/src/doc/book/variable-bindings.md @@ -241,7 +241,10 @@ println!("{}", x); // Prints "42" Shadowing and mutable bindings may appear as two sides of the same coin, but they are two distinct concepts that can't always be used interchangeably. For one, shadowing enables us to rebind a name to a value of a different type. It -is also possible to change the mutability of a binding. +is also possible to change the mutability of a binding. Note that shadowing a +name does not alter or destroy the value it was bound to, and the value will +continue to exist until it goes out of scope, even if it is no longer accessible +by any means. ```rust let mut x: i32 = 1; |
