forked from rust-lang/unsafe-code-guidelines
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt to document the current state of union.
I have tried to document everything I believe we have consensus on. I've left some things open that I possibly could have closed, but because this PR is very big, I would like to focus on getting it in as quickly as possible and worrying about whatever's left aftwards. I strongly encourage others to submit follow up PRs to close out the other open issues. Closes rust-lang#156. Closes rust-lang#298. Closes rust-lang#352.
- Loading branch information
Showing
4 changed files
with
364 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,29 @@ | ||
# Unions | ||
|
||
TBD | ||
## Outstanding questions | ||
|
||
* Is `#[repr(Rust)]` the bag-o-bytes union repr, or do we want to propose a new repr? | ||
* *Discussion:* [#73: Validity of unions][#73] | ||
* The following questions are all implicitly answered if `#[repr(Rust)]` is the bag-o-bytes repr, but remain open if not: | ||
* Do `#[repr(Rust)]` enums guarantee all fields at offset 0? | ||
* *Discussion*: [#353: Offsets of union fields][#353] | ||
* Do `#[repr(Rust)]` enums have internal padding? | ||
* *Discussion*: [#354: Do #[repr(Rust)] enums have internal padding?][#354] | ||
* Do `#[repr(transparent)]` enums ever have niches? | ||
* *Discussion*: [#364: What is the value model/validity invariant for transparent unions?][#364] | ||
|
||
## Closed discussion issues: | ||
|
||
* [#13: Representation of unions][#13] | ||
* [#156: Layout of repr(C) unions has padding][#156] | ||
* [#298: Is `repr(transparent)` completely transparent within `repr(Rust)` types?][#298] | ||
* [#352: What is the safety invariant, if any, for unions?][#352] | ||
|
||
[#13]: https://github.com/rust-lang/unsafe-code-guidelines/issues/13 | ||
[#156]: https://github.com/rust-lang/unsafe-code-guidelines/issues/156 | ||
[#298]: https://github.com/rust-lang/unsafe-code-guidelines/issues/298 | ||
[#352]: https://github.com/rust-lang/unsafe-code-guidelines/issues/352 | ||
[#353]: https://github.com/rust-lang/unsafe-code-guidelines/issues/353 | ||
[#354]: https://github.com/rust-lang/unsafe-code-guidelines/issues/354 | ||
[#364]: https://github.com/rust-lang/unsafe-code-guidelines/issues/364 | ||
[#73]: https://github.com/rust-lang/unsafe-code-guidelines/issues/73 |
This file contains 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
This file contains 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
Oops, something went wrong.