2016-04-26 12:51:14 -05:00
|
|
|
// force-host
|
|
|
|
|
|
|
|
#![feature(plugin_registrar)]
|
|
|
|
#![feature(box_syntax, rustc_private)]
|
|
|
|
|
2020-03-29 11:08:01 -05:00
|
|
|
extern crate rustc_middle;
|
2019-07-06 12:56:20 -05:00
|
|
|
extern crate rustc_driver;
|
2016-04-26 12:51:14 -05:00
|
|
|
|
|
|
|
use std::any::Any;
|
|
|
|
use std::cell::RefCell;
|
2019-07-16 12:08:32 -05:00
|
|
|
use rustc_driver::plugin::Registry;
|
2016-04-26 12:51:14 -05:00
|
|
|
|
|
|
|
struct Foo {
|
|
|
|
foo: isize
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Drop for Foo {
|
|
|
|
fn drop(&mut self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[plugin_registrar]
|
|
|
|
pub fn registrar(_: &mut Registry) {
|
|
|
|
thread_local!(static FOO: RefCell<Option<Box<Any+Send>>> = RefCell::new(None));
|
|
|
|
FOO.with(|s| *s.borrow_mut() = Some(box Foo { foo: 10 } as Box<Any+Send>));
|
|
|
|
}
|