-
Notifications
You must be signed in to change notification settings - Fork 246
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
Transfer the packed attribute on unions to repr(packed) #347
Transfer the packed attribute on unions to repr(packed) #347
Conversation
CI seems broken; the above tests ran through, and now also contain a test for the new code. I've also run the tests against an old build; these fail as is characteristic for a good test. (The unpacked union would be of size 8 instead of 5). Oh, one more remark on this PR: All nontrivial code is lifted from structs over to unions, not necessarily understanding every detail. It does work, and all the copied code looks unsuspicious, but still I'd like to point that out for reviewers. (There's probably an opportunity for some refactoring, but I'd like to keep that separate from the changes, especially as there already is code duplicated in this style). |
@chrysn the Darwin failures were due to timeouts as far as I can tell. I've opened a PR to get CI working properly again. |
Is there anything that should be addressed about this PR? Does it help if I rebase it onto current master? |
LTGM but I'm no expert on packed unions so I'd like a second pair of eyes before we merge. And yes, rebasing onto current master would be nice. |
As for the correctness of the built unions, the way I'm using them
frequently transmutes them back and forth between parts generated by
bindgen and those generated by C2Rust. As part of these transmutes, I'm
checking the size behind the pointer -- and they match ever since I'm on
this branch.
Rebased onto master and pushed for consumption by the CI; I haven't run
my full use case (which does these tests as part of everyday operation)
on the rebased branch yet.
|
I've given the rebased packed-unions a test run. Most tests also merged in the minimal-309 branch referenced in #309 (comment), as that's necessary for other parts of the code. As expected, that branch has passed the inline casting tests (asserting that bindgen's view of the C structs is as large as C2Rust's), which current master plus minimal-309 does not). |
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 LGTM and does what it says on the tin. I think we should merge.
I think it's worth noting separately, however, that we still have some holes in our support of the |
Closes: #346
This should be a straightforward solution to #346, and works for me on RIOT (which also means I can't easily test it on the main branch, as I still need my for-riot vendor branch that has #311 and the branch mentioned in #309 merged).
There are no tests yet; is
the right procedure?