Skip to content
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

Allow deriving Zeroable for enums which are #[repr(u32, i8, etc..)] #230

Closed
ARitz-Cracker opened this issue Mar 11, 2024 · 2 comments · Fixed by #257
Closed

Allow deriving Zeroable for enums which are #[repr(u32, i8, etc..)] #230

ARitz-Cracker opened this issue Mar 11, 2024 · 2 comments · Fixed by #257

Comments

@ARitz-Cracker
Copy link

If an enum is explicitly defined in a manner where "0" is a valid variant, and all the payloads of the 0 variant are zeroable, then it concludes that the enum is safely zeroable.

@ARitz-Cracker
Copy link
Author

ARitz-Cracker commented Mar 11, 2024

Additionally (though this may be a separate issue) an enum which is #[repr(u8)] and has all 256 variants explicitly defined can safely implement Pod.

@Lokathor
Copy link
Owner

That all sounds right to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants