Skip to content

Commit

Permalink
Merge pull request #147 from gnzlbg/val_union
Browse files Browse the repository at this point in the history
Validity of unions with a zero-sized field
  • Loading branch information
RalfJung authored Jul 18, 2019
2 parents b0b8de7 + 64107bd commit acd2339
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions reference/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
- [Function pointers](./layout/function-pointers.md)
- [Arrays and Slices](./layout/arrays-and-slices.md)
- [Packed SIMD vectors](./layout/packed-simd-vectors.md)
- [Validity](./validity.md)
- [Unions](./validity/unions.md)
- [Optimizations](./optimizations.md)
- [Return value optimization](./optimizations/return_value_optimization.md)
13 changes: 13 additions & 0 deletions reference/src/validity/unions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Validity of unions

**Disclaimer**: This chapter is a work-in-progress. What's contained here
represents the consensus from issue [#73]. The statements in here are not (yet)
"guaranteed" not to change until an RFC ratifies them.

## Validity of unions with zero-sized fields

A union containing a zero-sized field can contain any bit pattern. An example of such
an union is [`MaybeUninit`].

[#73]: https://github.com/rust-lang/unsafe-code-guidelines/issues/73
[`MaybeUninit`]: https://doc.rust-lang.org/std/mem/union.MaybeUninit.html

0 comments on commit acd2339

Please sign in to comment.