arbitrary
arbitrary copied to clipboard
Derive should throw an error when applying field attributes to variants
See https://github.com/rust-fuzz/arbitrary/issues/149
It's easy to accidentally write code like this:
#[derive(Arbitrary)]
enum Foo {
A(u8),
#[arbitrary(with = |_| Bar::new())]
B(Bar).
}
Here, the attribute will not have any effect since it needs to be on the field, not the variant.
We should definitely error if a field attribute is found on a variant. We could optionally make the above case (where the variant has a single field) transparently work.