1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#![warn(clippy::non_send_fields_in_send_ty)]
#![feature(extern_types)]
use std::rc::Rc;
// Basic tests should not be affected
pub struct NoGeneric {
rc_is_not_send: Rc<String>,
}
unsafe impl Send for NoGeneric {}
pub struct MultiField<T> {
field1: T,
field2: T,
field3: T,
}
unsafe impl<T> Send for MultiField<T> {}
pub enum MyOption<T> {
MySome(T),
MyNone,
}
unsafe impl<T> Send for MyOption<T> {}
// All fields are disallowed when raw pointer heuristic is off
extern "C" {
type NonSend;
}
pub struct HeuristicTest {
field1: Vec<*const NonSend>,
field2: [*const NonSend; 3],
field3: (*const NonSend, *const NonSend, *const NonSend),
field4: (*const NonSend, Rc<u8>),
field5: Vec<Vec<*const NonSend>>,
}
unsafe impl Send for HeuristicTest {}
fn main() {}
|