@@ -92,17 +92,24 @@ depends both on its own category and the context it occurs within.
92
92
93
93
A * place expression* is an expression that represents a memory location. These
94
94
expressions are [ paths] which refer to local variables, [ static variables] ,
95
- [ dereferences] & nbsp ; (` *expr ` ), [ array indexing] expressions (` expr[expr] ` ),
95
+ [ dereferences] [ deref ] (` *expr ` ), [ array indexing] expressions (` expr[expr] ` ),
96
96
[ field] references (` expr.f ` ) and parenthesized place expressions. All other
97
97
expressions are value expressions.
98
98
99
99
A * value expression* is an expression that represents an actual value.
100
100
101
- The left operand of an [ assignment] [ assign ] or [ compound assignment] expression
102
- is a place expression context, as is the single operand of a unary [ borrow] , and
103
- the operand of any [ implicit borrow] . The discriminant or subject of a
104
- [ match expression] [ match ] and right side of a [ let statement] is also a place
105
- expression context. All other expression contexts are value expression contexts.
101
+ The following contexts are * place expression* contexts:
102
+
103
+ * The left operand of an [ assignment] [ assign ] or [ compound assignment]
104
+ expression.
105
+ * The operand of a unary [ borrow] or [ dereference] [ deref ] operator.
106
+ * The operand of a field expression.
107
+ * The indexed operand of an array indexing expression.
108
+ * The operand of any [ implicit borrow] .
109
+ * The initializer of a [ let statement] .
110
+ * The [ scrutinee] of an [ ` if let ` ] , [ ` match ` ] [ match ] , or [ ` while let ` ]
111
+ expression.
112
+ * The base of a [ functional update] struct expression.
106
113
107
114
> Note: Historically, place expressions were called * lvalues* and value
108
115
> expressions were called * rvalues* .
@@ -119,8 +126,8 @@ move the value. Only the following place expressions may be moved out of:
119
126
* [ Temporary values] ( #temporary-lifetimes ) .
120
127
* [ Fields] [ field ] of a place expression which can be moved out of and
121
128
doesn't implement [ ` Drop ` ] .
122
- * The result of [ dereferencing] an expression with type [ ` Box<T> ` ] and that can
123
- also be moved out of.
129
+ * The result of [ dereferencing] [ deref ] an expression with type [ ` Box<T> ` ] and
130
+ that can also be moved out of.
124
131
125
132
Moving out of a place expression that evaluates to a local variable, the
126
133
location is deinitialized and cannot be read from again until it is
@@ -141,7 +148,7 @@ The following expressions can be mutable place expression contexts:
141
148
* [ Temporary values] .
142
149
* [ Fields] [ field ] , this evaluates the subexpression in a mutable place
143
150
expression context.
144
- * [ Dereferences] of a ` *mut T ` pointer.
151
+ * [ Dereferences] [ deref ] of a ` *mut T ` pointer.
145
152
* Dereference of a variable, or field of a variable, with type ` &mut T ` . Note:
146
153
This is an exception to the requirement of the next rule.
147
154
* Dereferences of a type that implements ` DerefMut ` , this then requires that
@@ -239,7 +246,7 @@ Implicit borrows may be taken in the following expressions:
239
246
* Left operand in [ field] expressions.
240
247
* Left operand in [ call expressions] .
241
248
* Left operand in [ array indexing] expressions.
242
- * Operand of the [ dereference operator] \ (` * ` ).
249
+ * Operand of the [ dereference operator] [ deref ] (` * ` ).
243
250
* Operands of [ comparison] .
244
251
* Left operands of the [ compound assignment] .
245
252
@@ -279,14 +286,17 @@ They are never allowed before:
279
286
[ closure expressions ] : expressions/closure-expr.html
280
287
[ enum variant ] : expressions/enum-variant-expr.html
281
288
[ field ] : expressions/field-expr.html
289
+ [ functional update ] : expressions/struct-expr.html#functional-update-syntax
282
290
[ grouped ] : expressions/grouped-expr.html
291
+ [ `if let` ] : expressions/if-expr.html#if-let-expressions
283
292
[ literals ] : expressions/literal-expr.html
284
293
[ match ] : expressions/match-expr.html
285
294
[ method-call ] : expressions/method-call-expr.html
286
295
[ paths ] : expressions/path-expr.html
287
296
[ range expressions ] : expressions/range-expr.html
288
297
[ struct ] : expressions/struct-expr.html
289
298
[ tuple expressions ] : expressions/tuple-expr.html
299
+ [ `while let` ] : expressions/loop-expr.html#predicate-pattern-loops
290
300
291
301
[ array expressions ] : expressions/array-expr.html
292
302
[ array indexing ] : expressions/array-expr.html#array-and-slice-indexing-expressions
@@ -297,9 +307,7 @@ They are never allowed before:
297
307
[ cast ] : expressions/operator-expr.html#type-cast-expressions
298
308
[ comparison ] : expressions/operator-expr.html#comparison-operators
299
309
[ compound assignment ] : expressions/operator-expr.html#compound-assignment-expressions
300
- [ dereferences ] : expressions/operator-expr.html#the-dereference-operator
301
- [ dereferencing ] : expressions/operator-expr.html#the-dereference-operator
302
- [ dereference operator ] : expressions/operator-expr.html#the-dereference-operator
310
+ [ deref ] : expressions/operator-expr.html#the-dereference-operator
303
311
[ lazy boolean ] : expressions/operator-expr.html#lazy-boolean-operators
304
312
[ negation ] : expressions/operator-expr.html#negation-operators
305
313
[ overflow ] : expressions/operator-expr.html#overflow
@@ -316,6 +324,7 @@ They are never allowed before:
316
324
[ let statement ] : statements.html#let-statements
317
325
[ Mutable `static` items ] : items/static-items.html#mutable-statics
318
326
[ const contexts ] : const_eval.html
327
+ [ scrutinee ] : glossary.html#scrutinee
319
328
[ slice ] : types/slice.html
320
329
[ statement ] : statements.html
321
330
[ static variables ] : items/static-items.html
0 commit comments