>>530
どう見てもスコープ内で渡されてますねえ

use std::thread;
use std::time::Duration;

fn main() {
let handle;
{
let mut local_data = 100;
println!("スレッド外の値: {}", local_data);
let local_data_ref = &mut local_data;
unsafe {
handle = thread::Builder::new()
.name("dangerous_thread".to_string())
.spawn_unchecked(move || {
thread::sleep(Duration::from_millis(500));
println!("スレッド内の値: {}", local_data_ref);
*local_data_ref = 200;
println!("スレッド内の値: {}", local_data_ref);
})
.unwrap();
}
}
println!("local_data消失");
handle.join().unwrap();
}