Merge pull request #396 from kberov/outdated-move-error

details in error E0382 changed over time
This commit is contained in:
Carol (Nichols || Goulding)
2017-01-17 22:38:07 -05:00
committed by GitHub
+10 -8
View File
@@ -364,14 +364,16 @@ You’ll get an error like this because Rust prevents you from using the
invalidated reference: invalidated reference:
```text ```text
5:22 error: use of moved value: `s1` [E0382] error[E0382]: use of moved value: `s1`
println!("{}", s1); --> src/main.rs:4:27
^~ |
5:24 note: in this expansion of println! (defined in <std macros>) 3 | let s2 = s1;
3:11 note: `s1` moved here because it has type `collections::string::String`, | -- value moved here
which is moved by default 4 | println!("{}, world!",s1);
let s2 = s1; | ^^ value used here after move
^~ |
= note: move occurs because `s1` has type `std::string::String`,
which does not implement the `Copy` trait
``` ```
If you’ve heard the terms “shallow copy” and “deep copy” while working with If you’ve heard the terms “shallow copy” and “deep copy” while working with