From 04ecedd6ecf54fed68872ca1c59eb5ece699863c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 22 Aug 2019 16:21:46 +0300 Subject: [PATCH] :arrow_up: syn, quote, proc_macro2 --- components/salsa-macros/Cargo.toml | 8 ++++---- components/salsa-macros/src/database_storage.rs | 1 - components/salsa-macros/src/query_group.rs | 16 ++++++++-------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/components/salsa-macros/Cargo.toml b/components/salsa-macros/Cargo.toml index 0f8b4485..7af47210 100644 --- a/components/salsa-macros/Cargo.toml +++ b/components/salsa-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "salsa-macros" -version = "0.13.0" +version = "0.13.1" authors = ["Salsa developers"] edition = "2018" license = "Apache-2.0 OR MIT" @@ -13,6 +13,6 @@ proc-macro = true [dependencies] heck = "0.3" -proc-macro2 = "0.4" -quote = "0.6" -syn = { version = "0.15.29", features = ["full", "extra-traits"] } +proc-macro2 = "1.0" +quote = "1.0" +syn = { version = "1.0", features = ["full", "extra-traits"] } diff --git a/components/salsa-macros/src/database_storage.rs b/components/salsa-macros/src/database_storage.rs index 5e67d806..ed0156d7 100644 --- a/components/salsa-macros/src/database_storage.rs +++ b/components/salsa-macros/src/database_storage.rs @@ -193,7 +193,6 @@ impl QueryGroup { .segments .last() .unwrap() - .value() .ident .clone() } diff --git a/components/salsa-macros/src/query_group.rs b/components/salsa-macros/src/query_group.rs index 4d5af7e7..7682a029 100644 --- a/components/salsa-macros/src/query_group.rs +++ b/components/salsa-macros/src/query_group.rs @@ -89,26 +89,26 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream } // Extract keys. - let mut iter = method.sig.decl.inputs.iter(); + let mut iter = method.sig.inputs.iter(); match iter.next() { - Some(FnArg::SelfRef(sr)) if sr.mutability.is_none() => (), + Some(FnArg::Receiver(sr)) if sr.mutability.is_none() => (), _ => panic!( "first argument of query `{}` must be `&self`", method.sig.ident ), } - let mut keys = vec![]; + let mut keys: Vec = vec![]; for arg in iter { match *arg { - FnArg::Captured(ref arg) => { - keys.push(arg.ty.clone()); + FnArg::Typed(ref arg) => { + keys.push((*arg.ty).clone()); } ref a => panic!("unsupported argument `{:?}` of `{}`", a, method.sig.ident), } } // Extract value. - let value = match method.sig.decl.output { + let value = match method.sig.output { ReturnType::Type(_, ref ty) => ty.as_ref().clone(), ref r => panic!( "unsupported return type `{:?}` of `{}`", @@ -503,7 +503,7 @@ impl TryFrom for SalsaAttr { } let name = attr.path.segments[1].ident.to_string(); - let tts = attr.tts.into(); + let tts = attr.tokens.into(); Ok(SalsaAttr { name, tts }) } } @@ -511,7 +511,7 @@ impl TryFrom for SalsaAttr { fn is_not_salsa_attr_path(path: &syn::Path) -> bool { path.segments .first() - .map(|s| s.value().ident != "salsa") + .map(|s| s.ident != "salsa") .unwrap_or(true) || path.segments.len() != 2 }