]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | #![crate_name="issue_2526"] |
2 | #![crate_type = "lib"] | |
223e47cc | 3 | |
85aaf69f SL |
4 | use std::marker; |
5 | ||
9cc50fc6 | 6 | pub struct arc_destruct<T: Sync> { |
c34b1796 | 7 | _data: isize, |
85aaf69f | 8 | _marker: marker::PhantomData<T> |
223e47cc LB |
9 | } |
10 | ||
1a4d82fc JJ |
11 | impl<T: Sync> Drop for arc_destruct<T> { |
12 | fn drop(&mut self) {} | |
223e47cc LB |
13 | } |
14 | ||
c34b1796 | 15 | fn arc_destruct<T: Sync>(data: isize) -> arc_destruct<T> { |
223e47cc | 16 | arc_destruct { |
85aaf69f SL |
17 | _data: data, |
18 | _marker: marker::PhantomData | |
223e47cc LB |
19 | } |
20 | } | |
21 | ||
1a4d82fc | 22 | fn arc<T: Sync>(_data: T) -> arc_destruct<T> { |
223e47cc LB |
23 | arc_destruct(0) |
24 | } | |
25 | ||
26 | fn init() -> arc_destruct<context_res> { | |
1a4d82fc | 27 | arc(context_res()) |
223e47cc LB |
28 | } |
29 | ||
9cc50fc6 | 30 | pub struct context_res { |
c34b1796 | 31 | ctx : isize, |
223e47cc LB |
32 | } |
33 | ||
34 | impl Drop for context_res { | |
1a4d82fc | 35 | fn drop(&mut self) {} |
223e47cc LB |
36 | } |
37 | ||
38 | fn context_res() -> context_res { | |
39 | context_res { | |
40 | ctx: 0 | |
41 | } | |
42 | } | |
43 | ||
44 | pub type context = arc_destruct<context_res>; |