标签: concurrency rust closures
根据Rust书籍,以下代码可能导致closure may outlive the current function错误:
closure may outlive the current function
use std::thread; fn main() { let x = 1; thread::spawn(|| { println!("x is {}", x); }); }
认为闭包何时以及如何比现在的功能发生更为抽象是抽象的;你能提供任何例子或规格吗?