From 8f42a6b39765caa55f1b13f12a255097e6ea178f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 Sep 2023 07:26:56 +0000 Subject: [PATCH] build(deps): update syn requirement from 1.0.109 to 2.0.38 Updates the requirements on [syn](https://github.com/dtolnay/syn) to permit the latest version. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/1.0.109...2.0.38) --- updated-dependencies: - dependency-name: syn dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- Cargo.toml | 2 +- macros/builtin/Cargo.toml | 2 +- macros/builtin/src/lib.rs | 8 ++++---- macros/src/declare_derive2.rs | 7 +++---- macros/src/rdl_macro.rs | 6 +++--- macros/src/symbol_process.rs | 5 +---- 6 files changed, 13 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3bfe2f466..0d3a4ead8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -77,7 +77,7 @@ scoped_threadpool = "0.1.9" serde = "1.0" serde_json = "1.0.82" smallvec = "1.8.0" -syn = "1.0.109" +syn = "2.0.38" tiny-skia-path = {version = "0.11.0"} unicode-bidi = "0.3.7" unicode-script = "0.5.4" diff --git a/macros/builtin/Cargo.toml b/macros/builtin/Cargo.toml index 7c9bc3ec1..8d783f27a 100644 --- a/macros/builtin/Cargo.toml +++ b/macros/builtin/Cargo.toml @@ -22,4 +22,4 @@ smallvec.workspace = true [dependencies.syn] features = ["full"] -version = "1.0.109" +version = "2.0.37" diff --git a/macros/builtin/src/lib.rs b/macros/builtin/src/lib.rs index e1aa40bbd..6a4b0e9f9 100644 --- a/macros/builtin/src/lib.rs +++ b/macros/builtin/src/lib.rs @@ -81,8 +81,8 @@ impl ToTokens for Item { Item::Field { doc_attr, mem, _colon, ty } => { let ty = quote! { #ty }.to_string(); let name = mem.to_string(); - let doc = match &doc_attr.lit { - syn::Lit::Str(str) => str, + let doc = match &doc_attr.value { + syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Str(str), .. }) => str, _ => unreachable!(), }; tokens.extend(quote! { @@ -96,8 +96,8 @@ impl ToTokens for Item { Item::Method { doc_attr, sign } => { let name = sign.ident.to_string(); let sign = sign.to_token_stream().to_string(); - let doc = match &doc_attr.lit { - syn::Lit::Str(str) => str, + let doc = match &doc_attr.value { + syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Str(str), .. }) => str, _ => unreachable!(), }; tokens.extend(quote! { diff --git a/macros/src/declare_derive2.rs b/macros/src/declare_derive2.rs index fc40f7c23..da2645d34 100644 --- a/macros/src/declare_derive2.rs +++ b/macros/src/declare_derive2.rs @@ -307,10 +307,9 @@ fn collect_filed_and_attrs(stt: &mut DataStruct) -> Result>(|pair| { let (field, comma) = pair.into_tuple(); - let idx = field - .attrs - .iter() - .position(|attr| attr.path.is_ident(DECLARE_ATTR)); + let idx = field.attrs.iter().position( + |attr| matches!(&attr.meta, syn::Meta::List(l) if l.path.is_ident(DECLARE_ATTR)), + ); let builder_attr = if let Some(idx) = idx { let attr = field.attrs.remove(idx); let args: DeclareAttr = attr.parse_args()?; diff --git a/macros/src/rdl_macro.rs b/macros/src/rdl_macro.rs index e88cebf8e..9280c1d61 100644 --- a/macros/src/rdl_macro.rs +++ b/macros/src/rdl_macro.rs @@ -14,7 +14,7 @@ use syn::{ parse_macro_input, parse_quote, punctuated::Punctuated, spanned::Spanned, - token::{Bang, Brace, Colon, Comma, Dollar}, + token::{Brace, Colon, Comma, Dollar, Not}, Expr, Ident, Macro, Path, Result as SynResult, Stmt, }; @@ -115,7 +115,7 @@ impl Parse for StructLiteral { break; } - if content.peek(kw::rdl) && content.peek2(Bang) { + if content.peek(kw::rdl) && content.peek2(Not) { children.push(content.parse()?); } else if content.peek(Ident) { let f: DeclareField = content.parse()?; @@ -142,7 +142,7 @@ impl Parse for StructLiteral { impl Parse for RdlParent { fn parse(input: ParseStream) -> SynResult { - if input.peek(kw::_dollar_ಠ_ಠ) && input.peek2(Bang) { + if input.peek(kw::_dollar_ಠ_ಠ) && input.peek2(Not) { let mac: Macro = input.parse()?; Ok(RdlParent::Var(mac.parse_body_with( diff --git a/macros/src/symbol_process.rs b/macros/src/symbol_process.rs index ef1f16f26..f9cde1706 100644 --- a/macros/src/symbol_process.rs +++ b/macros/src/symbol_process.rs @@ -204,11 +204,8 @@ impl Fold for DollarRefsCtx { fn fold_local(&mut self, mut i: syn::Local) -> syn::Local { // we fold right expression first, then fold pattern, because the `=` is a // right operator. - i.init = i - .init - .map(|(assign, e)| (assign, Box::new(self.fold_expr(*e)))); + i.init = i.init.map(|init| self.fold_local_init(init)); i.pat = self.fold_pat(i.pat); - i }