Skip to content

Commit acd2339

Browse files
authored
Merge pull request #147 from gnzlbg/val_union
Validity of unions with a zero-sized field
2 parents b0b8de7 + 64107bd commit acd2339

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

reference/src/SUMMARY.md

+2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@
1111
- [Function pointers](./layout/function-pointers.md)
1212
- [Arrays and Slices](./layout/arrays-and-slices.md)
1313
- [Packed SIMD vectors](./layout/packed-simd-vectors.md)
14+
- [Validity](./validity.md)
15+
- [Unions](./validity/unions.md)
1416
- [Optimizations](./optimizations.md)
1517
- [Return value optimization](./optimizations/return_value_optimization.md)

reference/src/validity/unions.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Validity of unions
2+
3+
**Disclaimer**: This chapter is a work-in-progress. What's contained here
4+
represents the consensus from issue [#73]. The statements in here are not (yet)
5+
"guaranteed" not to change until an RFC ratifies them.
6+
7+
## Validity of unions with zero-sized fields
8+
9+
A union containing a zero-sized field can contain any bit pattern. An example of such
10+
an union is [`MaybeUninit`].
11+
12+
[#73]: https://github.com/rust-lang/unsafe-code-guidelines/issues/73
13+
[`MaybeUninit`]: https://doc.rust-lang.org/std/mem/union.MaybeUninit.html

0 commit comments

Comments
 (0)