-
Notifications
You must be signed in to change notification settings - Fork 714
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
Use repr(packed)
If struct requires explicit alignment of 1.
#1075
Conversation
r? @fitzgen |
} else { | ||
let ty = helpers::blob(Layout::new(0, layout.align)); | ||
fields.push(quote! { | ||
pub __bindgen_align: #ty , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will only work to increase alignment, right? So what if we are decreasing alignment (but not all the way to 1
)? I guess that requires #pragma packed
or __attribute__((aligned(..)))
which we don't fully support yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. If one would try to decrease alignment it would lead to layout test failure... just as it is now.
#( #attributes )* | ||
pub struct #canonical_ident | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole chunk is just code motion right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!
Thanks as always, @pepyakin ! @bors-servo r+ |
📌 Commit 746c743 has been approved by |
Use `repr(packed)` If struct requires explicit alignment of 1. Fixes #1034
☀️ Test successful - status-travis |
Fixes #1034