Skip to content

Commit 0b805c6

Browse files
authored
Merge pull request #1509 from nefelitav/union-syntax-patch
union syntax fix for empty field list
2 parents 6019b76 + b10666f commit 0b805c6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/items/unions.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
> **<sup>Syntax</sup>**\
44
> _Union_ :\
55
> &nbsp;&nbsp; `union` [IDENTIFIER]&nbsp;[_GenericParams_]<sup>?</sup> [_WhereClause_]<sup>?</sup>
6-
> `{`[_StructFields_] `}`
6+
> `{`[_StructFields_]<sup>?</sup> `}`
77
88
A union declaration uses the same syntax as a struct declaration, except with
99
`union` in place of `struct`.
@@ -30,6 +30,8 @@ This restriction ensures, in particular, that union fields never need to be
3030
dropped. Like for structs and enums, it is possible to `impl Drop` for a union
3131
to manually define what happens when it gets dropped.
3232

33+
Unions without any fields are not accepted by the compiler, but can be accepted by macros.
34+
3335
## Initialization of a union
3436

3537
A value of a union type can be created using the same syntax that is used for

0 commit comments

Comments
 (0)