-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doing #[reflect(ignore)]
on fields in a struct still requires Default
on that field
#13851
Comments
This is actually expected behavior since There are two possible solutions besides implementing
Hopefully that helps! |
As for how we can avoid this in the future, I think we could update the macro code to make One possible issue is that this would mean that users won't be 100% sure their type implements |
If this is a longer term solution, is the near term is it possible in the derive macro to detect the lacking default impl and report on it?
If I was guided towards this in the error msg that would have helped me right away, which would be very nice |
Unfortunately no. Macros don't have any type information available to them, including what traits a type implements.
Yeah ideally we would do this, but it's not possible to know whether or not a type implements |
Bevy version
Latest: 1395e36
What you did
What went wrong
I couldn't ignore a field on my struct which I wanted to derive reflect on, since that field did not impl
Default
and I had no control over that field.My expectation was that the field is ignored entirely with no limitations.
The text was updated successfully, but these errors were encountered: