From 28e1e22e01d5a845a3d599efe8db4a78789c8ab9 Mon Sep 17 00:00:00 2001 From: Sean Bowe Date: Sat, 21 Mar 2026 07:46:37 -0600 Subject: [PATCH] ff_derive: update syn, num-bigint, addchain --- Cargo.lock | 30 +++++++++--------------------- ff_derive/Cargo.toml | 6 +++--- ff_derive/src/lib.rs | 19 ++++++------------- 3 files changed, 18 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 220e21e..d73bcdf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 4 [[package]] name = "addchain" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2e69442aa5628ea6951fa33e24efe8313f4321a91bd729fc2f75bdfc858570" +checksum = "5665045de74fda906c0abfaec40cf2551f88c34dccea869f3fe950dde7209764" dependencies = [ "num-bigint", "num-integer", @@ -113,7 +113,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 1.0.109", + "syn", ] [[package]] @@ -213,11 +213,10 @@ checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "num-bigint" -version = "0.3.3" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ - "autocfg", "num-integer", "num-traits", ] @@ -247,7 +246,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn 2.0.114", + "syn", ] [[package]] @@ -318,7 +317,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn", ] [[package]] @@ -340,17 +339,6 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.114" @@ -462,7 +450,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn 2.0.114", + "syn", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -478,7 +466,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn 2.0.114", + "syn", "wit-bindgen-core", "wit-bindgen-rust", ] diff --git a/ff_derive/Cargo.toml b/ff_derive/Cargo.toml index 6ae2aa0..2c37257 100644 --- a/ff_derive/Cargo.toml +++ b/ff_derive/Cargo.toml @@ -22,13 +22,13 @@ bits = [] proc-macro = true [dependencies] -addchain = "0.2" -num-bigint = "0.3" +addchain = "0.3" +num-bigint = "0.4" num-traits = "0.2" num-integer = "0.1" proc-macro2 = "1" quote = "1" -syn = { version = "1", features = ["full"] } +syn = { version = "2", features = ["full"] } [badges] maintenance = { status = "passively-maintained" } diff --git a/ff_derive/src/lib.rs b/ff_derive/src/lib.rs index ac9f78d..d40a242 100644 --- a/ff_derive/src/lib.rs +++ b/ff_derive/src/lib.rs @@ -302,21 +302,14 @@ fn validate_struct(ast: &syn::DeriveInput, limbs: usize) -> Option Option { for attr in attrs { - if let Ok(meta) = attr.parse_meta() { - match meta { - syn::Meta::NameValue(nv) => { - if nv.path.get_ident().map(|i| i.to_string()) == Some(name.to_string()) { - match nv.lit { - syn::Lit::Str(ref s) => return Some(s.value()), - _ => { - panic!("attribute {} should be a string", name); - } - } + if let syn::Meta::NameValue(nv) = &attr.meta { + if nv.path.get_ident().map(|i| i.to_string()) == Some(name.to_string()) { + if let syn::Expr::Lit(expr_lit) = &nv.value { + if let syn::Lit::Str(ref s) = expr_lit.lit { + return Some(s.value()); } } - _ => { - panic!("attribute {} should be a string", name); - } + panic!("attribute {} should be a string", name); } } }