trpl-zh-cn/listings/ch16-fearless-concurrency/output-only-01-move-drop/src/main.rs
2022-02-06 16:43:51 +08:00

14 lines
208 B
Rust
Executable File

use std::thread;
fn main() {
let v = vec![1, 2, 3];
let handle = thread::spawn(move || {
println!("Here's a vector: {:?}", v);
});
drop(v); // oh no!
handle.join().unwrap();
}