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/glossary.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -133,6 +133,14 @@ These were formerly known as *object safe* traits.
133
133
134
134
A [*path*] is a sequence of one or more path segments used to refer to an [entity](#entity) in the current scope or other levels of a [namespace](#namespace) hierarchy.
135
135
136
+
### Place projection
137
+
138
+
r[glossary.place-projection]
139
+
A *place projection* is a [field access], [tuple index], [dereference] (and automatic dereferences), [array or slice index] expression, or [pattern destructuring] applied to a variable.
140
+
141
+
> [!NOTE]
142
+
> In `rustc`, pattern destructuring desugars into a series of dereferences and field or element accesses.
143
+
136
144
### Prelude
137
145
138
146
Prelude, or The Rust Prelude, is a small collection of items - mostly traits - that are imported into every module of every crate. The traits in the prelude are pervasive.
@@ -211,15 +219,18 @@ r[glossary.uninhabited]
211
219
212
220
A type is uninhabited if it has no constructors and therefore can never be instantiated. An uninhabited type is "empty" in the sense that there are no values of the type. The canonical example of an uninhabited type is the [never type]`!`, or an enum with no variants `enum Never { }`. Opposite of [Inhabited](#inhabited).
213
221
222
+
[array or slice index]: ../expressions/array-expr.md#array-and-slice-indexing-expressions
A *place projection* is a [field access], [tuple index], [dereference] (and automatic dereferences), [array or slice index] expression, or [pattern destructuring] applied to a variable.
101
-
102
-
> [!NOTE]
103
-
> In `rustc`, pattern destructuring desugars into a series of dereferences and field or element accesses.
97
+
A *capture path* is a sequence starting with a variable from the environment followed by zero or more [place projections][glossary.place-projection] from that variable.
104
98
105
99
r[type.closure.capture.precision.intro]
106
100
The closure borrows or moves the capture path, which may be truncated based on the rules described below.
@@ -121,12 +115,6 @@ c();
121
115
122
116
Here the capture path is the local variable `s`, followed by a field access `.f1`, and then a tuple index `.1`. This closure captures an immutable borrow of `s.f1.1`.
0 commit comments