-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
New compilation error with #[repr(C, align(16))]
and bytemuck_derive 1.2.0
#127
Comments
What does rust report that the size of Foo is? because, if it's repr(C) then i'm not sure it's going to be size 0 (C is weird about size 0 stuff), and if it's not size 0 and it's align 16 then it will have padding. |
Sorry, the 0-element struct was just for minimality. The same behavior appears when the struct is non-empty. For example I have the explicitly-"padded" struct #[repr(C, align(16))]
#[derive(Debug, Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)]
pub(crate) struct PaddedVec3 {
pub data: [f32; 3],
padding: f32,
} that fails in the same way. (4 × |
Yeah, this would absolutely be a bug then. I also suspect the cleanup. I'll pass this along to the person that did that cleanup pass, and try to get something soon. In the mean time, of course you can always manually do the impl (though that's less than ideal i know). |
FYI, I can confirm the published fix is working. Thanks! |
Excellent! |
The following minimal reproduction case compiles when using
bytemuck_derive
1.1.0 but not when using 1.2.0:Pod
cannot have padding, of course; the intent of thisalign
repr in my real code is not to add padding, but to require the struct fields to add up to a multiple of 16 bytes or fail compilation. This used to work, but now fails to compile withbytemuck_derive
1.2.0:I imagine commit 2c97676 is probably responsible for this regression since it substantially changed repr handling.
The text was updated successfully, but these errors were encountered: