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