Skip to content

Commit 188d553

Browse files
committed
Align pattern destructuring with rest of doc
Previously, `patterns.destructure.placeholder` referred to the `_` in a destructuring pattern as "placeholder" and `..` as "wildcard". This directly contradicted the definition of struct patterns and tuple (struct) patterns, which (indirectly) define `_` as a wildcard pattern and `..` as a structure pattern et cetera (for structs, enums, and union values) or rest pattern (for tuples, tuple structs, slices, and arrays). Update the paragraph to use "wildcard pattern", "et cetera", and "rest pattern" instead. Moreover, add links to their respective sections/statements. Don't update the reference `r[patterns.destructure.placeholder]`, as changes might break (third-party) links to the updated paragraph.
1 parent a24e6e9 commit 188d553

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/patterns.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Destructuring breaks up a value into its component pieces.
9393
The syntax used is almost the same as when creating such values.
9494

9595
r[patterns.destructure.placeholder]
96-
In a pattern whose [scrutinee] expression has a `struct`, `enum` or `tuple` type, a placeholder (`_`) stands in for a *single* data field, whereas a wildcard `..` stands in for *all* the remaining fields of a particular variant.
96+
In a pattern whose [scrutinee] expression has a `struct`, `enum` or `tuple` type, a [wildcard pattern](#wildcard-pattern) (`_`) stands in for a *single* data field, whereas an [et cetera](#grammar-StructPatternEtCetera) or [rest pattern](#rest-patterns) (`..`) stands in for *all* the remaining fields of a particular variant.
9797

9898
r[patterns.destructure.named-field-shorthand]
9999
When destructuring a data structure with named (but not numbered) fields, it is allowed to write `fieldname` as a shorthand for `fieldname: fieldname`.

0 commit comments

Comments
 (0)