Skip to content

Commit 5381a94

Browse files
committed
Add a note about unions to the expressions section
1 parent 81f447e commit 5381a94

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/expressions.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,9 @@ the field values of a new instance of the struct. A field name can be any
267267
[identifier](identifiers.html), and is separated from its value expression by a
268268
colon. In the case of a tuple struct the field names are numbers corresponding
269269
to the position of the field. The numbers must be written in decimal,
270-
containing no underscores and with no leading zeros or integer suffix.
270+
containing no underscores and with no leading zeros or integer suffix. A value
271+
of a [union](items.html#unions) type can also be created using this syntax,
272+
except that it must specify exactly one field.
271273

272274
Struct expressions can't be used directly in the head of a [loop](#loops) or an
273275
[`if`](#if-expressions), [`if let`](#if-let-expressions) or

0 commit comments

Comments
 (0)