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