From a03f60472d18512b05b4ddab02d8871c81be1c46 Mon Sep 17 00:00:00 2001 From: Patrick LaFontaine <32135464+Pat-Lafon@users.noreply.github.com> Date: Wed, 27 Sep 2023 17:09:00 -0400 Subject: [PATCH] Small version updates --- hashconsing_derive/Cargo.toml | 6 +++--- hashconsing_derive/src/lib.rs | 17 ++++++++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/hashconsing_derive/Cargo.toml b/hashconsing_derive/Cargo.toml index a671b35..b2cc1e0 100644 --- a/hashconsing_derive/Cargo.toml +++ b/hashconsing_derive/Cargo.toml @@ -9,8 +9,8 @@ edition = "2021" proc-macro = true [dependencies] -darling = "0.14.2" -proc-macro-error = "1.0.4" +darling = "0.20" +proc-macro-error = "1.0" proc-macro2 = "1.0" quote = "1.0" -syn = { version = "1.0", features = ["full"] } +syn = { version = "2.0", features = ["full"] } diff --git a/hashconsing_derive/src/lib.rs b/hashconsing_derive/src/lib.rs index fe3a8b4..962e6bc 100644 --- a/hashconsing_derive/src/lib.rs +++ b/hashconsing_derive/src/lib.rs @@ -1,12 +1,12 @@ -use darling::{util::Flag, FromMeta, Result}; +use darling::{ast::NestedMeta, util::Flag, Error, FromMeta, Result}; use proc_macro::{self, TokenStream}; use proc_macro2::Span; use proc_macro_error::{abort_call_site, proc_macro_error}; use quote::{format_ident, quote}; use syn::{ - parse_macro_input, punctuated::Punctuated, token::Paren, AttributeArgs, Data, DataEnum, - DeriveInput, Expr, ExprCall, ExprPath, FnArg, Pat, PatIdent, PatType, Path, PathArguments, - PathSegment, Token, + parse_macro_input, punctuated::Punctuated, token::Paren, Data, DataEnum, DeriveInput, Expr, + ExprCall, ExprPath, FnArg, Pat, PatIdent, PatType, Path, PathArguments, PathSegment, + Token, }; #[derive(Debug, Default, FromMeta)] @@ -32,7 +32,14 @@ impl MacroArgs { #[proc_macro_attribute] pub fn hcons(args: TokenStream, mut input: TokenStream) -> TokenStream { let parsed_input = input.clone(); - let attr_args = parse_macro_input!(args as AttributeArgs); + + let attr_args = match NestedMeta::parse_meta_list(args.into()) { + Ok(v) => v, + Err(e) => { + return TokenStream::from(Error::from(e).write_errors()); + } + }; + let DeriveInput { ident, vis,