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
@@ -54,7 +54,7 @@ where
let attrs = if let Some(attrs) = item.mut_item_attrs() { attrs } else { return Ok(None) };
if let Some(index) = attrs.iter().position(|attr| {
attr.path.segments.first().map_or(false, |segment| segment.ident == "pallet")
attr.path().segments.first().map_or(false, |segment| segment.ident == "pallet")
}) {
let pallet_attr = attrs.remove(index);
Ok(Some(syn::parse2(pallet_attr.into_token_stream())?))
@@ -82,7 +82,7 @@ pub fn get_item_cfg_attrs(attrs: &[syn::Attribute]) -> Vec<syn::Attribute> {
attrs
.iter()
.filter_map(|attr| {
if attr.path.segments.first().map_or(false, |segment| segment.ident == "cfg") {
if attr.path().segments.first().map_or(false, |segment| segment.ident == "cfg") {
Some(attr.clone())
} else {
None
@@ -101,7 +101,6 @@ impl MutItemAttrs for syn::Item {
Self::ForeignMod(item) => Some(item.attrs.as_mut()),
Self::Impl(item) => Some(item.attrs.as_mut()),
Self::Macro(item) => Some(item.attrs.as_mut()),
Self::Macro2(item) => Some(item.attrs.as_mut()),
Self::Mod(item) => Some(item.attrs.as_mut()),
Self::Static(item) => Some(item.attrs.as_mut()),
Self::Struct(item) => Some(item.attrs.as_mut()),
@@ -119,7 +118,7 @@ impl MutItemAttrs for syn::TraitItem {
fn mut_item_attrs(&mut self) -> Option<&mut Vec<syn::Attribute>> {
match self {
Self::Const(item) => Some(item.attrs.as_mut()),
Self::Method(item) => Some(item.attrs.as_mut()),
Self::Fn(item) => Some(item.attrs.as_mut()),
Self::Type(item) => Some(item.attrs.as_mut()),
Self::Macro(item) => Some(item.attrs.as_mut()),
_ => None,
@@ -139,7 +138,7 @@ impl MutItemAttrs for syn::ItemMod {
}
}
impl MutItemAttrs for syn::ImplItemMethod {
impl MutItemAttrs for syn::ImplItemFn {
fn mut_item_attrs(&mut self) -> Option<&mut Vec<syn::Attribute>> {
Some(&mut self.attrs)
}