1 | // Check that `!Send` types fail early. |
2 | |
3 | /** ```compile_fail,E0277 |
4 | |
5 | use rayon::prelude::*; |
6 | use std::ptr::null; |
7 | |
8 | #[derive(Copy, Clone)] |
9 | struct NoSend(*const ()); |
10 | |
11 | unsafe impl Sync for NoSend {} |
12 | |
13 | let x = Some(NoSend(null())); |
14 | |
15 | x.par_iter() |
16 | .map(|&x| x) //~ ERROR |
17 | .count(); //~ ERROR |
18 | |
19 | ``` */ |
20 | mod map {} |
21 | |
22 | /** ```compile_fail,E0277 |
23 | |
24 | use rayon::prelude::*; |
25 | use std::ptr::null; |
26 | |
27 | #[derive(Copy, Clone)] |
28 | struct NoSend(*const ()); |
29 | |
30 | unsafe impl Sync for NoSend {} |
31 | |
32 | let x = Some(NoSend(null())); |
33 | |
34 | x.par_iter() |
35 | .filter_map(|&x| Some(x)) //~ ERROR |
36 | .count(); //~ ERROR |
37 | |
38 | ``` */ |
39 | mod filter_map {} |
40 | |
41 | /** ```compile_fail,E0277 |
42 | |
43 | use rayon::prelude::*; |
44 | use std::ptr::null; |
45 | |
46 | #[derive(Copy, Clone)] |
47 | struct NoSend(*const ()); |
48 | |
49 | unsafe impl Sync for NoSend {} |
50 | |
51 | let x = Some(NoSend(null())); |
52 | |
53 | x.par_iter() |
54 | .cloned() //~ ERROR |
55 | .count(); //~ ERROR |
56 | |
57 | ``` */ |
58 | mod cloned {} |
59 | |