Skip to content

Commit c544e83

Browse files
committed
Rebasing
1 parent 103e52b commit c544e83

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

src/test/auxiliary/custom_derive_plugin.rs

+5-13
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ extern crate rustc;
1919

2020
use syntax::ast;
2121
use syntax::codemap::Span;
22-
use syntax::ext::base::{Decorator, ExtCtxt, Annotatable};
22+
use syntax::ext::base::{MultiDecorator, ExtCtxt, Annotatable};
2323
use syntax::ext::build::AstBuilder;
2424
use syntax::ext::deriving::generic::{cs_fold, TraitDef, MethodDef, combine_substructure};
2525
use syntax::ext::deriving::generic::ty::{Literal, LifetimeBounds, Path, borrowed_explicit_self};
@@ -31,14 +31,14 @@ use rustc::plugin::Registry;
3131
pub fn plugin_registrar(reg: &mut Registry) {
3232
reg.register_syntax_extension(
3333
token::intern("derive_TotalSum"),
34-
Decorator(box expand));
34+
MultiDecorator(box expand));
3535
}
3636

3737
fn expand(cx: &mut ExtCtxt,
3838
span: Span,
3939
mitem: &ast::MetaItem,
40-
item: &ast::Item,
41-
push: &mut FnMut(P<ast::Item>)) {
40+
item: Annotatable,
41+
push: &mut FnMut(Annotatable)) {
4242
let trait_def = TraitDef {
4343
span: span,
4444
attributes: vec![],
@@ -70,13 +70,5 @@ fn expand(cx: &mut ExtCtxt,
7070
],
7171
};
7272

73-
trait_def.expand(cx,
74-
mitem,
75-
Annotatable::Item(P(item.clone())),
76-
&mut |i| {
77-
match i {
78-
Annotatable::Item(i) => push(i),
79-
_ => panic!("Not an item")
80-
}
81-
})
73+
trait_def.expand(cx, mitem, &item, push)
8274
}

src/test/auxiliary/custom_derive_plugin_attr.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ extern crate rustc;
2020
use syntax::ast;
2121
use syntax::attr::AttrMetaMethods;
2222
use syntax::codemap::Span;
23-
use syntax::ext::base::{Decorator, ExtCtxt};
23+
use syntax::ext::base::{MultiDecorator, ExtCtxt, Annotatable};
2424
use syntax::ext::build::AstBuilder;
2525
use syntax::ext::deriving::generic::{cs_fold, TraitDef, MethodDef, combine_substructure};
2626
use syntax::ext::deriving::generic::{Substructure, Struct, EnumMatching};
@@ -33,14 +33,14 @@ use rustc::plugin::Registry;
3333
pub fn plugin_registrar(reg: &mut Registry) {
3434
reg.register_syntax_extension(
3535
token::intern("derive_TotalSum"),
36-
Decorator(box expand));
36+
MultiDecorator(box expand));
3737
}
3838

3939
fn expand(cx: &mut ExtCtxt,
4040
span: Span,
4141
mitem: &ast::MetaItem,
42-
item: &ast::Item,
43-
push: &mut FnMut(P<ast::Item>)) {
42+
item: Annotatable,
43+
push: &mut FnMut(Annotatable)) {
4444
let trait_def = TraitDef {
4545
span: span,
4646
attributes: vec![],
@@ -61,7 +61,7 @@ fn expand(cx: &mut ExtCtxt,
6161
],
6262
};
6363

64-
trait_def.expand(cx, mitem, item, push)
64+
trait_def.expand(cx, mitem, &item, push)
6565
}
6666

6767
// Mostly copied from syntax::ext::deriving::hash

0 commit comments

Comments
 (0)