From e9768a0a76d4c61af8e8d1760bd91cdb40ca72bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Jan=20Niemier?= Date: Sun, 18 Sep 2016 22:45:53 +0200 Subject: [PATCH] Rebase leftovers --- macros/src/lib.rs | 65 ----------------------------------------------- 1 file changed, 65 deletions(-) diff --git a/macros/src/lib.rs b/macros/src/lib.rs index db39a45..d00f1e8 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -26,71 +26,6 @@ pub fn from_primitive(input: TokenStream) -> TokenStream { let ast = syn::parse_item(&source).unwrap(); -macro_rules! pathvec_std { - ($cx:expr, $first:ident :: $($rest:ident)::+) => ({ - let mut v = pathvec!($($rest)::+); - if let Some(s) = $cx.crate_root { - v.insert(0, s); - } - v - }) -} - -pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt, - span: Span, - mitem: &MetaItem, - item: &Annotatable, - push: &mut FnMut(Annotatable)) -{ - let inline = cx.meta_word(span, InternedString::new("inline")); - let attrs = vec!(cx.attribute(span, inline)); - let trait_def = TraitDef { - is_unsafe: false, - span: span, - attributes: Vec::new(), - path: path!(num::FromPrimitive), - additional_bounds: Vec::new(), - generics: LifetimeBounds::empty(), - methods: vec!( - MethodDef { - name: "from_i64", - is_unsafe: false, - unify_fieldless_variants: false, - generics: LifetimeBounds::empty(), - explicit_self: None, - args: vec!(Literal(path_local!(i64))), - ret_ty: Literal(Path::new_(pathvec_std!(cx, core::option::Option), - None, - vec!(Box::new(Self_)), - true)), - // #[inline] liable to cause code-bloat - attributes: attrs.clone(), - combine_substructure: combine_substructure(Box::new(|c, s, sub| { - cs_from("i64", c, s, sub) - })), - }, - MethodDef { - name: "from_u64", - is_unsafe: false, - unify_fieldless_variants: false, - generics: LifetimeBounds::empty(), - explicit_self: None, - args: vec!(Literal(path_local!(u64))), - ret_ty: Literal(Path::new_(pathvec_std!(cx, core::option::Option), - None, - vec!(Box::new(Self_)), - true)), - // #[inline] liable to cause code-bloat - attributes: attrs, - combine_substructure: combine_substructure(Box::new(|c, s, sub| { - cs_from("u64", c, s, sub) - })), - } - ), - associated_types: Vec::new(), - supports_unions: false, - }; - let mut idx = 0; let variants: Vec<_> = variants.iter() .map(|variant| {