]> git.proxmox.com Git - rustc.git/blame - vendor/rustc-rayon-core/src/compile_fail/scope_join_bad.rs
New upstream version 1.40.0+dfsg1
[rustc.git] / vendor / rustc-rayon-core / src / compile_fail / scope_join_bad.rs
CommitLineData
e74abb32 1/*! ```compile_fail,E0373
2c00a5a8
XL
2
3fn bad_scope<F>(f: F)
4 where F: FnOnce(&i32) + Send,
5{
532ac7d7 6 rayon_core::scope(|s| {
2c00a5a8
XL
7 let x = 22;
8 s.spawn(|_| f(&x)); //~ ERROR `x` does not live long enough
9 });
10}
11
12fn good_scope<F>(f: F)
13 where F: FnOnce(&i32) + Send,
14{
15 let x = 22;
532ac7d7 16 rayon_core::scope(|s| {
2c00a5a8
XL
17 s.spawn(|_| f(&x));
18 });
19}
20
21fn main() {
22}
532ac7d7
XL
23
24``` */