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-04-14 21:00:31 +05:30
|
|
|
#![feature(macro_registrar)]
|
2014-02-11 22:43:23 -08:00
|
|
|
|
2014-02-14 10:10:06 -08:00
|
|
|
extern crate syntax;
|
2014-02-11 22:43:23 -08:00
|
|
|
|
|
|
|
use std::any::Any;
|
|
|
|
use syntax::ast::Name;
|
|
|
|
use syntax::ext::base::SyntaxExtension;
|
|
|
|
|
|
|
|
struct Foo {
|
|
|
|
foo: int
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Drop for Foo {
|
|
|
|
fn drop(&mut self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[macro_registrar]
|
|
|
|
pub fn registrar(_: |Name, SyntaxExtension|) {
|
2014-05-05 18:56:44 -07:00
|
|
|
local_data_key!(foo: Box<Any:Send>);
|
2014-04-28 20:36:08 -07:00
|
|
|
foo.replace(Some(box Foo { foo: 10 } as Box<Any:Send>));
|
2014-02-11 22:43:23 -08:00
|
|
|
}
|
|
|
|
|