Unboxed closures: function signature of expand* changed

This commit is contained in:
Thomas Bahn 2015-01-02 13:32:54 +01:00
parent 814c0570b8
commit d09b9eb72c
2 changed files with 8 additions and 9 deletions

View File

@ -1,4 +1,4 @@
#![feature(plugin_registrar, quote)]
#![feature(plugin_registrar, quote, unboxed_closures)]
extern crate syntax;
extern crate rustc;
@ -62,8 +62,7 @@ fn expand_deriving_serialize<>(cx: &mut ExtCtxt,
sp: Span,
mitem: &MetaItem,
item: &Item,
push: |P<ast::Item>|) //where
//F: FnOnce(P<ast::Item>)
mut push: Box<FnMut(P<ast::Item>)>)
{
let inline = cx.meta_word(sp, token::InternedString::new("inline"));
let attrs = vec!(cx.attribute(sp, inline));
@ -129,7 +128,7 @@ fn expand_deriving_serialize<>(cx: &mut ExtCtxt,
]
};
trait_def.expand(cx, mitem, item, |item| push(item))
trait_def.expand(cx, mitem, item, |item| push.call_mut((item,)))
}
fn serialize_substructure(cx: &ExtCtxt, span: Span, substr: &Substructure) -> P<Expr> {

View File

@ -1,7 +1,7 @@
#![crate_name = "serde_macros"]
#![crate_type = "dylib"]
#![feature(plugin_registrar, quote)]
#![feature(plugin_registrar, quote, unboxed_closures)]
extern crate syntax;
extern crate rustc;
@ -70,7 +70,7 @@ fn expand_deriving_serialize(cx: &mut ExtCtxt,
sp: Span,
mitem: &MetaItem,
item: &Item,
push: |P<ast::Item>|) {
mut push: Box<FnMut(P<ast::Item>)>) {
let inline = cx.meta_word(sp, token::InternedString::new("inline"));
let attrs = vec!(cx.attribute(sp, inline));
@ -113,7 +113,7 @@ fn expand_deriving_serialize(cx: &mut ExtCtxt,
})
};
trait_def.expand(cx, mitem, item, |item| push(item))
trait_def.expand(cx, mitem, item, |item| push.call_mut((item,)))
}
fn serialize_substructure(cx: &ExtCtxt,
@ -199,7 +199,7 @@ pub fn expand_deriving_deserialize(cx: &mut ExtCtxt,
span: Span,
mitem: &MetaItem,
item: &Item,
push: |P<Item>|) {
mut push: Box<FnMut(P<Item>)>) {
let trait_def = TraitDef {
span: span,
attributes: Vec::new(),
@ -244,7 +244,7 @@ pub fn expand_deriving_deserialize(cx: &mut ExtCtxt,
})
};
trait_def.expand(cx, mitem, item, |item| push(item))
trait_def.expand(cx, mitem, item, |item| push.call_mut((item,)))
}
fn deserialize_substructure(cx: &mut ExtCtxt,