Skip to content

Commit 99f2734

Browse files
committed
langref: improve zero bit types documentation
In the Zero Bit Types section, clarify that a non empty zero bit union just needs to have all fields of zero bit type, instead of only one field of zero bit type. Clarify that empty struct, enum, union and error set are currently problematic.
1 parent fe6dcdb commit 99f2734

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

doc/langref.html.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6627,7 +6627,7 @@ test "peer type resolution: *const T and ?*T" {
66276627
<li>{#link|Arrays#} and {#link|Vectors#} with len 0, or with an element type that is a zero bit type.</li>
66286628
<li>An {#link|enum#} with only 1 tag.</li>
66296629
<li>A {#link|struct#} with all fields being zero bit types.</li>
6630-
<li>A {#link|union#} with only 1 field which is a zero bit type.</li>
6630+
<li>An {#link|union#} with all fields being zero bit types.</li>
66316631
</ul>
66326632
<p>
66336633
These types can only ever have one possible value, and thus
@@ -6650,6 +6650,9 @@ export fn entry() void {
66506650
15: c3 retq </code></pre>
66516651
<p>These assembly instructions do not have any code associated with the void values -
66526652
they only perform the function call prologue and epilogue.</p>
6653+
<p>Using empty {#link|struct#}, empty {#link|enum#}, empty {#link|union#},
6654+
and empty {#link|Error Set Type#} is problematic, and may be a compile error in the future.
6655+
For details on this subscribe to <a href="https://github.com/ziglang/zig/issues/13807">this issue</a>.
66536656

66546657
{#header_open|void#}
66556658
<p>

0 commit comments

Comments
 (0)