|
13 | 13 | extern crate syntax;
|
14 | 14 | extern crate rustc;
|
15 | 15 |
|
16 |
| -use syntax::ast::{MetaItem, Item, Expr}; |
| 16 | +use syntax::ast::{MetaItem, Expr}; |
17 | 17 | use syntax::ast;
|
18 | 18 | use syntax::codemap::Span;
|
19 |
| -use syntax::ext::base::ExtCtxt; |
| 19 | +use syntax::ext::base::{ExtCtxt, Annotatable}; |
20 | 20 | use syntax::ext::build::AstBuilder;
|
21 | 21 | use syntax::ext::deriving::generic::*;
|
22 | 22 | use syntax::ext::deriving::generic::ty::*;
|
23 | 23 | use syntax::parse::token::InternedString;
|
24 | 24 | use syntax::ptr::P;
|
25 |
| -use syntax::ext::base::Decorator; |
| 25 | +use syntax::ext::base::MultiDecorator; |
26 | 26 | use syntax::parse::token;
|
27 | 27 |
|
28 | 28 | use rustc::plugin::Registry;
|
@@ -64,8 +64,8 @@ macro_rules! path_std {
|
64 | 64 | pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt,
|
65 | 65 | span: Span,
|
66 | 66 | mitem: &MetaItem,
|
67 |
| - item: &Item, |
68 |
| - push: &mut FnMut(P<Item>)) |
| 67 | + item: Annotatable, |
| 68 | + push: &mut FnMut(Annotatable)) |
69 | 69 | {
|
70 | 70 | let inline = cx.meta_word(span, InternedString::new("inline"));
|
71 | 71 | let attrs = vec!(cx.attribute(span, inline));
|
@@ -110,7 +110,7 @@ pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt,
|
110 | 110 | associated_types: Vec::new(),
|
111 | 111 | };
|
112 | 112 |
|
113 |
| - trait_def.expand(cx, mitem, item, push) |
| 113 | + trait_def.expand(cx, mitem, &item, push) |
114 | 114 | }
|
115 | 115 |
|
116 | 116 | fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> P<Expr> {
|
@@ -196,5 +196,5 @@ fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure
|
196 | 196 | pub fn plugin_registrar(reg: &mut Registry) {
|
197 | 197 | reg.register_syntax_extension(
|
198 | 198 | token::intern("derive_NumFromPrimitive"),
|
199 |
| - Decorator(Box::new(expand_deriving_from_primitive))); |
| 199 | + MultiDecorator(Box::new(expand_deriving_from_primitive))); |
200 | 200 | }
|
0 commit comments