From d09b9eb72c9633f145ebf5e37b02a2733fdf189f Mon Sep 17 00:00:00 2001 From: Thomas Bahn Date: Fri, 2 Jan 2015 13:32:54 +0100 Subject: [PATCH] Unboxed closures: function signature of expand* changed --- serde2/serde2_macros/src/lib.rs | 7 +++---- serde_macros/src/lib.rs | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/serde2/serde2_macros/src/lib.rs b/serde2/serde2_macros/src/lib.rs index 280d6459..12f00078 100644 --- a/serde2/serde2_macros/src/lib.rs +++ b/serde2/serde2_macros/src/lib.rs @@ -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|) //where - //F: FnOnce(P) + mut push: Box)>) { 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 { diff --git a/serde_macros/src/lib.rs b/serde_macros/src/lib.rs index a1450d7b..4aef1ab5 100644 --- a/serde_macros/src/lib.rs +++ b/serde_macros/src/lib.rs @@ -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|) { + mut push: Box)>) { 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|) { + mut push: Box)>) { 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,