]>
Commit | Line | Data |
---|---|---|
74b04a01 XL |
1 | $ cargo run |
2 | Compiling threads v0.1.0 (file:///projects/threads) | |
3 | error[E0382]: use of moved value: `v` | |
4 | --> src/main.rs:10:10 | |
5 | | | |
6 | 4 | let v = vec![1, 2, 3]; | |
fc512014 | 7 | | - move occurs because `v` has type `Vec<i32>`, which does not implement the `Copy` trait |
74b04a01 XL |
8 | 5 | |
9 | 6 | let handle = thread::spawn(move || { | |
10 | | ------- value moved into closure here | |
11 | 7 | println!("Here's a vector: {:?}", v); | |
12 | | - variable moved due to use in closure | |
13 | ... | |
14 | 10 | drop(v); // oh no! | |
15 | | ^ value used here after move | |
16 | ||
17 | error: aborting due to previous error | |
18 | ||
19 | For more information about this error, try `rustc --explain E0382`. | |
fc512014 | 20 | error: could not compile `threads` |
74b04a01 XL |
21 | |
22 | To learn more, run the command again with --verbose. |