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)]
|
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-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-06-11 12:14:38 -07:00
|
|
|
local_data_key!(foo: Box<Any+Send>);
|
|
|
|
foo.replace(Some(box Foo { foo: 10 } as Box<Any+Send>));
|
2014-02-11 22:43:23 -08:00
|
|
|
}
|
|
|
|
|