The code is a bit convoluted because my use case is having options in an attribute macro, not a derive one, and I wanted to be able to write #[my_macro(choices(one(params...), other))]. I could not directly have a Vec<Choice> in Opts, it fails because Vec<Choice> doesn't implement FromMeta even though I derive FromMeta on Choice, that's why I added the Choices newtype.
Now it fails to emit an error on the last example because of this change in the FromMeta derived for Choice:
The change in #260 allows non-existent fields to be added to an enum variant, and be silently ignored by
FromMeta::from_list
.See the test I added in https://github.com/Sufflope/darling/blob/306_unknown_fields_are_ignored_in_unit_enum_variants/tests/unknown_fields.rs which passed up to
0.20.3
(adding parameters to the unitChoice::Other
yields an error) and fails on the last example since0.20.4
because the parameters are just ignored and I don't get an error.The code is a bit convoluted because my use case is having options in an attribute macro, not a derive one, and I wanted to be able to write
#[my_macro(choices(one(params...), other))]
. I could not directly have aVec<Choice>
inOpts
, it fails becauseVec<Choice>
doesn't implementFromMeta
even though I deriveFromMeta
onChoice
, that's why I added theChoices
newtype.Now it fails to emit an error on the last example because of this change in the
FromMeta
derived forChoice
:Maybe I'm doing something completely wrong? I wrote this code initially on
darling
0.14
and I'm trying to update to0.20
actually.