You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/types/closure.md
+68-2Lines changed: 68 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,7 +98,10 @@ Async closures always capture all input arguments, regardless of whether or not
98
98
## Capture Precision
99
99
100
100
r[type.closure.capture.precision.capture-path]
101
-
A *capture path* is a sequence starting with a variable from the environment followed by zero or more place projections that were applied to that variable.
101
+
A *capture path* is a sequence starting with a variable from the environment followed by zero or more place projections that were applied to that variable, as well as
102
+
any [further projections performed by matching against patterns][pattern-wildcards].
A *place projection* is a [field access], [tuple index], [dereference] (and automatic dereferences), or [array or slice index] expression applied to a variable.
@@ -202,7 +205,7 @@ let c = || match x { // x is not captured
202
205
c();
203
206
```
204
207
205
-
This also includes destructuring of tuples, structs, and enums.
208
+
This also includes destructuring of tuples, structs, and single-variant enums.
206
209
Fields matched with the [RestPattern] or [StructPatternEtCetera] are also not considered as read, and thus those fields will not be captured.
0 commit comments