2014-02-11 22:43:23 -08:00
|
|
|
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
// force-host
|
|
|
|
|
2014-05-24 21:38:16 -07:00
|
|
|
#![feature(plugin_registrar)]
|
2015-01-07 18:53:58 -08:00
|
|
|
#![feature(box_syntax)]
|
2014-02-11 22:43:23 -08:00
|
|
|
|
2014-05-24 21:38:16 -07:00
|
|
|
extern crate rustc;
|
2014-02-11 22:43:23 -08:00
|
|
|
|
|
|
|
use std::any::Any;
|
2014-11-14 14:20:57 -08:00
|
|
|
use std::cell::RefCell;
|
2014-05-24 21:38:16 -07:00
|
|
|
use rustc::plugin::Registry;
|
2014-02-11 22:43:23 -08:00
|
|
|
|
|
|
|
struct Foo {
|
|
|
|
foo: int
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Drop for Foo {
|
|
|
|
fn drop(&mut self) {}
|
|
|
|
}
|
|
|
|
|
2014-05-24 21:38:16 -07:00
|
|
|
#[plugin_registrar]
|
|
|
|
pub fn registrar(_: &mut Registry) {
|
2014-11-14 14:20:57 -08:00
|
|
|
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>));
|
2014-02-11 22:43:23 -08:00
|
|
|
}
|