forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcycle-cache-err-150907.rs
More file actions
125 lines (96 loc) · 2.46 KB
/
cycle-cache-err-150907.rs
File metadata and controls
125 lines (96 loc) · 2.46 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// Test that we don't hang or take exponential time when evaluating
// auto-traits for cyclic types containing errors, based on the reproducer
// provided in issue #150907.
use std::sync::Arc;
use std::marker::PhantomData;
struct Weak<T>(PhantomData<T>);
unsafe impl<T: Sync + Send> Send for Weak<T> {}
unsafe impl<T: Sync + Send> Sync for Weak<T> {}
struct BTreeMap<K, V>(K, V);
trait DeviceOps: Send {}
struct SerialDevice {
terminal: Weak<Terminal>,
}
impl DeviceOps for SerialDevice {}
struct TtyState {
terminals: Weak<Terminal>,
}
struct TerminalMutableState {
controller: TerminalController,
}
struct Terminal {
weak_self: Weak<Self>,
state: Arc<TtyState>,
mutable_state: Weak<TerminalMutableState>,
}
struct TerminalController {
session: Weak<Session>,
}
struct Kernel {
weak_self: Weak<Kernel>,
kthreads: KernelThreads,
pids: Weak<PidTable>,
}
struct KernelThreads {
system_task: SystemTask,
kernel: Weak<Kernel>,
}
struct SystemTask {
system_thread_group: Weak<ThreadGroup>,
}
enum ProcessEntry {
ThreadGroup(Weak<ThreadGroup>),
}
struct PidEntry {
task: Arc<Task>,
process: ProcessEntry,
}
struct PidTable {
table: PidEntry,
process_groups: Arc<ProcessGroup>,
}
struct ProcessGroupMutableState {
thread_groups: Weak<ThreadGroup>,
}
struct ProcessGroup {
session: Arc<Session>,
mutable_state: Arc<ProcessGroupMutableState>,
}
struct SessionMutableState {
process_groups: BTreeMap<(), Weak<ProcessGroup>>,
controlling_terminal: ControllingTerminal,
}
struct Session {
mutable_state: Weak<SessionMutableState>,
}
struct ControllingTerminal {
terminal: Arc<Terminal>,
}
struct TaskPersistentInfoState {
thread_group_key: ThreadGroupKey,
}
struct Task {
thread_group_key: ThreadGroupKey,
kernel: Arc<Kernel>,
thread_group: Arc<ThreadGroup>,
persistent_info: Arc<TaskPersistentInfoState>,
vfork_event: Arc, //~ ERROR missing generics for struct `Arc`
}
struct ThreadGroupKey {
thread_group: Arc<ThreadGroup>,
}
struct ThreadGroupMutableState {
tasks: BTreeMap<(), TaskContainer>,
children: BTreeMap<(), Weak<ThreadGroup>>,
process_group: Arc<ProcessGroup>,
}
struct ThreadGroup {
kernel: Arc<Kernel>,
mutable_state: Weak<ThreadGroupMutableState>,
}
struct TaskContainer(Arc<Task>, Arc<TaskPersistentInfoState>);
fn main() {
// Trigger auto-trait check for one of the cyclic types
is_send::<Kernel>();
}
fn is_send<T: Send>() {}