]>
Commit | Line | Data |
---|---|---|
e74abb32 | 1 | /*! ```compile_fail,E0373 |
2c00a5a8 XL |
2 | |
3 | fn 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 | ||
12 | fn 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 | ||
21 | fn main() { | |
22 | } | |
532ac7d7 XL |
23 | |
24 | ``` */ |