mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-24 22:03:34 +00:00
⬆️ syn, quote, proc_macro2
This commit is contained in:
parent
4815e14796
commit
04ecedd6ec
3 changed files with 12 additions and 13 deletions
|
@ -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"] }
|
||||
|
|
|
@ -193,7 +193,6 @@ impl QueryGroup {
|
|||
.segments
|
||||
.last()
|
||||
.unwrap()
|
||||
.value()
|
||||
.ident
|
||||
.clone()
|
||||
}
|
||||
|
|
|
@ -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<Type> = 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<syn::Attribute> 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<syn::Attribute> 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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue