2016-04-26 12:51:14 -05:00
|
|
|
// force-host
|
|
|
|
|
2021-08-24 19:39:40 -05:00
|
|
|
#![feature(rustc_private)]
|
2016-04-26 12:51:14 -05:00
|
|
|
|
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) {}
|
|
|
|
}
|
|
|
|
|
2021-05-14 08:37:53 -05:00
|
|
|
#[no_mangle]
|
|
|
|
fn __rustc_plugin_registrar(_: &mut Registry) {
|
2016-04-26 12:51:14 -05:00
|
|
|
thread_local!(static FOO: RefCell<Option<Box<Any+Send>>> = RefCell::new(None));
|
2021-08-24 19:39:40 -05:00
|
|
|
FOO.with(|s| *s.borrow_mut() = Some(Box::new(Foo { foo: 10 }) as Box<Any+Send>));
|
2016-04-26 12:51:14 -05:00
|
|
|
}
|