@@ -597,8 +597,8 @@ Reference patterns are always irrefutable.
597597[ _OuterAttribute_ ] : attributes.md
598598[ TUPLE_INDEX ] : tokens.md#tuple-index
599599
600- Struct patterns match struct and enum values that match all criteria defined by its subpatterns.
601- They are also used to [ destructure] ( #destructuring ) a struct or enum value.
600+ Struct patterns match struct, enum, and union values that match all criteria defined by its subpatterns.
601+ They are also used to [ destructure] ( #destructuring ) a struct, enum, or union value.
602602
603603On a struct pattern, the fields are referenced by name, index (in the case of tuple structs) or ignored by use of ` .. ` :
604604
@@ -642,7 +642,7 @@ match m {
642642}
643643```
644644
645- If ` .. ` is not used, it is required to match all fields:
645+ If ` .. ` is not used, a struct pattern used to match a struct is required to specify all fields:
646646
647647``` rust
648648# struct Struct {
@@ -661,6 +661,8 @@ match struct_value {
661661}
662662```
663663
664+ A struct pattern used to match a union must specify exactly one field (see [ Pattern matching on unions] ).
665+
664666The ` ref ` and/or ` mut ` _ IDENTIFIER_ syntax matches any value and binds it to a variable with the same name as the given field.
665667
666668``` rust
@@ -867,6 +869,7 @@ For example, `x @ A(..) | B(..)` will result in an error that `x` is not bound i
867869[ literal expression ] : expressions/literal-expr.md
868870[ negating ] : expressions/operator-expr.md#negation-operators
869871[ path ] : expressions/path-expr.md
872+ [ pattern matching on unions ] : items/unions.md#pattern-matching-on-unions
870873[ range expressions ] : expressions/range-expr.md
871874[ structs ] : items/structs.md
872875[ tuples ] : types/tuple.md
0 commit comments