diff --git a/ff_derive/Cargo.toml b/ff_derive/Cargo.toml index c97fb5f..d26481e 100644 --- a/ff_derive/Cargo.toml +++ b/ff_derive/Cargo.toml @@ -22,7 +22,7 @@ num-traits = "0.2" num-integer = "0.1" proc-macro2 = "1" quote = "1" -syn = "1" +syn = { version = "1", features = ["full"] } [badges] maintenance = { status = "passively-maintained" } diff --git a/ff_derive/src/lib.rs b/ff_derive/src/lib.rs index ff21a3b..3da2354 100644 --- a/ff_derive/src/lib.rs +++ b/ff_derive/src/lib.rs @@ -252,11 +252,16 @@ fn validate_struct(ast: &syn::DeriveInput, limbs: usize) -> Option match &expr_lit.lit { - syn::Lit::Int(lit_int) => Some(lit_int), + let expr_lit = match &arr.len { + syn::Expr::Lit(expr_lit) => Some(&expr_lit.lit), + syn::Expr::Group(expr_group) => match &*expr_group.expr { + syn::Expr::Lit(expr_lit) => Some(&expr_lit.lit), _ => None, - }, + } + _ => None + }; + let lit_int = match match expr_lit { + Some(syn::Lit::Int(lit_int)) => Some(lit_int), _ => None, } { Some(x) => x,