mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-02-24 13:22:19 +08:00
14 lines
203 B
Rust
Executable File
14 lines
203 B
Rust
Executable File
use std::thread;
|
|
|
|
fn main() {
|
|
let v = vec![1, 2, 3];
|
|
|
|
let handle = thread::spawn(|| {
|
|
println!("Here's a vector: {:?}", v);
|
|
});
|
|
|
|
drop(v); // oh no!
|
|
|
|
handle.join().unwrap();
|
|
}
|