• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 fn main() {
14     let x = Some(NoSend(null()));
15 
16     x.par_iter()
17         .map(|&x| x) //~ ERROR
18         .count(); //~ ERROR
19 }
20 
21 ``` */
22 mod map {}
23 
24 /** ```compile_fail,E0277
25 
26 use rayon::prelude::*;
27 use std::ptr::null;
28 
29 #[derive(Copy, Clone)]
30 struct NoSend(*const ());
31 
32 unsafe impl Sync for NoSend {}
33 
34 fn main() {
35     let x = Some(NoSend(null()));
36 
37     x.par_iter()
38         .filter_map(|&x| Some(x)) //~ ERROR
39         .count(); //~ ERROR
40 }
41 
42 ``` */
43 mod filter_map {}
44 
45 /** ```compile_fail,E0277
46 
47 use rayon::prelude::*;
48 use std::ptr::null;
49 
50 #[derive(Copy, Clone)]
51 struct NoSend(*const ());
52 
53 unsafe impl Sync for NoSend {}
54 
55 fn main() {
56     let x = Some(NoSend(null()));
57 
58     x.par_iter()
59         .cloned() //~ ERROR
60         .count(); //~ ERROR
61 }
62 
63 ``` */
64 mod cloned {}
65