ty: More struct layout fixes for overaligned integers / aliases. - #3458
Merged
Conversation
This fixes most of the test-cases discussed in #3453. The remaining one is related to bitfields and needs a bit more thought (I think we currently don't pad bitfields based on the clang-reported offset and maybe should).
emilio
force-pushed
the
more-overaligned-stuff
branch
from
September 7, 2026 11:58
5344e5d to
cc051ab
Compare
Contributor
Author
|
cc @ojeda |
Contributor
|
This seems to fix most of them, and it is reassuring to have them as tests, thanks! With this PR, the case of passing |
Contributor
Author
|
Can you elaborate? Opaque types seem to work fine here as well? It gets aligned to 8 but padded, so effectively it gets aligned to 16, right? |
Contributor
|
Yeah, I meant that the alignment of the opaque type itself will be different (even if So if someone uses that type on both C and Rust, it could subtly break (e.g. Rust generates a pointer to a value not actually aligned to 16 that we pass to C). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes most of the test-cases discussed in #3453.
The remaining one is related to bitfields and needs a bit more thought (I think we currently don't pad bitfields based on the clang-reported offset and maybe should).