Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Noted that shadowing never destroys a value #34125

Merged
merged 1 commit into from Jun 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/doc/book/variable-bindings.md
Expand Up @@ -240,7 +240,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;
Expand Down