]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // force-host |
2 | ||
c34b1796 | 3 | #![feature(box_syntax, rustc_private)] |
1a4d82fc | 4 | |
ba9703b0 | 5 | extern crate rustc_middle; |
416331ca | 6 | extern crate rustc_driver; |
1a4d82fc JJ |
7 | |
8 | use std::any::Any; | |
9 | use std::cell::RefCell; | |
e1599b0c | 10 | use rustc_driver::plugin::Registry; |
1a4d82fc JJ |
11 | |
12 | struct Foo { | |
c34b1796 | 13 | foo: isize |
1a4d82fc JJ |
14 | } |
15 | ||
16 | impl Drop for Foo { | |
17 | fn drop(&mut self) {} | |
18 | } | |
19 | ||
94222f64 XL |
20 | #[no_mangle] |
21 | fn __rustc_plugin_registrar(_: &mut Registry) { | |
1a4d82fc JJ |
22 | thread_local!(static FOO: RefCell<Option<Box<Any+Send>>> = RefCell::new(None)); |
23 | FOO.with(|s| *s.borrow_mut() = Some(box Foo { foo: 10 } as Box<Any+Send>)); | |
24 | } |