Globally upgrade to syn 2.x and latest quote and proc_macro2 1x versions (#13846)

* globally upgrade quote to latest 1.0.x (1.0.26)

* globally upgrade syn to final 1.0.x version (1.0.109)

* globally upgrade proc-macro2 to 1.0.56

* upgrade to syn v2.0.13 and fix everything except NestedMeta

* fix parse nested metadata code in decl_runtime_apis.rs

* Port more stuff to syn 2.0

* Make the rest compile

* Ignore error

* update to syn 2.0.14

---------

Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
Sam Johnson
2023-04-12 14:42:22 -04:00
committed by GitHub
parent 03c99fe003
commit b83bf4784e
62 changed files with 402 additions and 478 deletions
@@ -209,13 +209,13 @@ impl HostFn {
"only #[version(<u8>)], #[unstable], #[prefixed_alias] and #[deprecated] attributes are allowed.";
let span = item.span();
let mut attrs = item.attrs.clone();
attrs.retain(|a| !a.path.is_ident("doc"));
attrs.retain(|a| !a.path().is_ident("doc"));
let mut maybe_version = None;
let mut is_stable = true;
let mut alias_to = None;
let mut not_deprecated = true;
while let Some(attr) = attrs.pop() {
let ident = attr.path.get_ident().ok_or(err(span, msg))?.to_string();
let ident = attr.path().get_ident().ok_or(err(span, msg))?.to_string();
match ident.as_str() {
"version" => {
if maybe_version.is_some() {
@@ -377,7 +377,7 @@ impl EnvDef {
_ => None,
};
let selector = |a: &syn::Attribute| a.path.is_ident("prefixed_alias");
let selector = |a: &syn::Attribute| a.path().is_ident("prefixed_alias");
let aliases = items
.iter()
@@ -401,7 +401,7 @@ impl EnvDef {
}
fn is_valid_special_arg(idx: usize, arg: &FnArg) -> bool {
let pat = if let FnArg::Typed(pat) = arg { pat } else { return false };
let FnArg::Typed(pat) = arg else { return false };
let ident = if let syn::Pat::Ident(ref ident) = *pat.pat { &ident.ident } else { return false };
let name_ok = match idx {
0 => ident == "ctx" || ident == "_ctx",
@@ -434,7 +434,7 @@ fn expand_func_doc(func: &HostFn) -> TokenStream2 {
);
quote! { #[doc = #alias_doc] }
} else {
let docs = func.item.attrs.iter().filter(|a| a.path.is_ident("doc")).map(|d| {
let docs = func.item.attrs.iter().filter(|a| a.path().is_ident("doc")).map(|d| {
let docs = d.to_token_stream();
quote! { #docs }
});