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
@@ -192,7 +192,7 @@ fn implement_common_api_traits(block_type: TypePath, self_ty: Type) -> Result<To
fn has_advanced_attribute(attributes: &mut Vec<Attribute>) -> bool {
let mut found = false;
attributes.retain(|attr| {
if attr.path.is_ident(ADVANCED_ATTRIBUTE) {
if attr.path().is_ident(ADVANCED_ATTRIBUTE) {
found = true;
false
} else {
@@ -258,7 +258,7 @@ impl<'a> FoldRuntimeApiImpl<'a> {
// We also need to overwrite all the `_with_context` methods. To do this,
// we clone all methods and add them again with the new name plus one more argument.
impl_item.items.extend(impl_item.items.clone().into_iter().filter_map(|i| {
if let syn::ImplItem::Method(mut m) = i {
if let syn::ImplItem::Fn(mut m) = i {
m.sig.ident = quote::format_ident!("{}_with_context", m.sig.ident);
m.sig.inputs.insert(2, parse_quote!( _: #crate_::ExecutionContext ));
@@ -290,7 +290,7 @@ impl<'a> FoldRuntimeApiImpl<'a> {
}
impl<'a> Fold for FoldRuntimeApiImpl<'a> {
fn fold_impl_item_method(&mut self, mut input: syn::ImplItemMethod) -> syn::ImplItemMethod {
fn fold_impl_item_fn(&mut self, mut input: syn::ImplItemFn) -> syn::ImplItemFn {
let block = {
let crate_ = generate_crate_access();
let is_advanced = has_advanced_attribute(&mut input.attrs);
@@ -377,7 +377,7 @@ impl<'a> Fold for FoldRuntimeApiImpl<'a> {
)
};
let mut input = fold::fold_impl_item_method(self, input);
let mut input = fold::fold_impl_item_fn(self, input);
// We need to set the block, after we modified the rest of the ast, otherwise we would
// modify our generated block as well.
input.block = block;