-
Notifications
You must be signed in to change notification settings - Fork 58
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
Detail layout of repr(C) unions #160
Conversation
reference/src/layout/unions.md
Outdated
# } | ||
``` | ||
|
||
**C++ compatibility hazard**: C++ does, in general, give a size of 1 to empty |
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.
Should we maybe say "struct with no field"? "empty" in Rust means something else than in C++.
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.
Can we add a link somewhere to the section about zero-sized types in structs-and-tuples.md
? That section goes into a lot more detail, e.g.
- explicitly stating that empty structs are illegal in C
- mentioning
[[no_unique_address]]
- differentiating between structs with no fields and structs with fields of zero size
There's no need to repeat all that here, but a link would be helpful.
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.
(Perhaps also mention that Rust unions can't have zero fields.)
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.
The text now uses "struct with no fields" and refers and links to the structs chapter for details.
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.
Some of your commits seem to have been lost? Like, "Link to struct chapter" just is not in this PR any more.
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.
That might not have been intended. I merged the "suggestion changes" and that had conflicts so I had to force push :/
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.
Force-push shouldn't be needed after merging...? Weird.
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.
I screw up. I need to learn how to "pull" changes to my branch locally and rebase them without spurious merge commits when my local branch has other changes :/
Co-Authored-By: Ralf Jung <[email protected]>
…es into reprc_unions
Other than this final issue about empty structs, I have one more remark. I felt it is eaiser to just open a PR against your PR for this: gnzlbg#1 |
mention size-filling padding
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.
I think we are finally there. :) Thanks for prevailing!
Documents the behavior described in #156 .