From 44679902bd8093c39e9fd21d1d34d66b1e71f7fd Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 14 May 2015 10:19:47 -0700 Subject: [PATCH] Update num-macros to Rust master --- .gitignore | 6 ++---- num-macros/Cargo.toml | 2 +- num-macros/src/lib.rs | 14 +++++++------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index af3d7a1..fa8d85a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ -/Cargo.lock -/num_macros/Cargo.lock -/num_macros/target -/target +Cargo.lock +target diff --git a/num-macros/Cargo.toml b/num-macros/Cargo.toml index acc9d12..d9bf538 100644 --- a/num-macros/Cargo.toml +++ b/num-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "num-macros" -version = "0.1.22" +version = "0.1.23" authors = ["The Rust Project Developers"] license = "MIT/Apache-2.0" homepage = "https://github.com/rust-lang/num" diff --git a/num-macros/src/lib.rs b/num-macros/src/lib.rs index f8c6b58..a83c8b5 100644 --- a/num-macros/src/lib.rs +++ b/num-macros/src/lib.rs @@ -13,16 +13,16 @@ extern crate syntax; extern crate rustc; -use syntax::ast::{MetaItem, Item, Expr}; +use syntax::ast::{MetaItem, Expr}; use syntax::ast; use syntax::codemap::Span; -use syntax::ext::base::ExtCtxt; +use syntax::ext::base::{ExtCtxt, Annotatable}; use syntax::ext::build::AstBuilder; use syntax::ext::deriving::generic::*; use syntax::ext::deriving::generic::ty::*; use syntax::parse::token::InternedString; use syntax::ptr::P; -use syntax::ext::base::Decorator; +use syntax::ext::base::MultiDecorator; use syntax::parse::token; use rustc::plugin::Registry; @@ -64,8 +64,8 @@ macro_rules! path_std { pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, - item: &Item, - push: &mut FnMut(P)) + item: Annotatable, + push: &mut FnMut(Annotatable)) { let inline = cx.meta_word(span, InternedString::new("inline")); let attrs = vec!(cx.attribute(span, inline)); @@ -110,7 +110,7 @@ pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt, associated_types: Vec::new(), }; - trait_def.expand(cx, mitem, item, push) + trait_def.expand(cx, mitem, &item, push) } fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> P { @@ -196,5 +196,5 @@ fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure pub fn plugin_registrar(reg: &mut Registry) { reg.register_syntax_extension( token::intern("derive_NumFromPrimitive"), - Decorator(Box::new(expand_deriving_from_primitive))); + MultiDecorator(Box::new(expand_deriving_from_primitive))); }