getset
getset copied to clipboard
Confusing error when `#[getset(get_copy = "pub")]` is specified but not `derive(CopyGetters)`
When #[getset(get_copy = "pub")] is specified but CopyGetters is not derived (only Getters), the proc-macro doesn't give an error, instead rustc gives the error that foo.bar() is not a method but a field.
Solution: The proc-macro could give an error. But I'd prefer another solution:
Remove CopyGetters altogether, only have Getters, such that get_copy works when Getters is derived. This makes much more sense IMO.
Or is there a reason to require the user to derive CopyGetters / any disadvantages when get_copy is also allowed with Getters?
To me it seems to be more verbose / requiring more typing than necessary, and I often forget to derive CopyGetters.
Aw shucks. :(
I think your suggestion is very reasonable.
(A similar issue occurs when I have #[getset(get = "pub", get_mut = "pub")] on a field, but forget to derive MutGetters (when I only have Getters), then there is also no error by the proc-macro, only at the call location rustc complains that the foo_mut() method doesn't exist.)
Why not make a step further and derive only a single target, say GetSet?