@@ -140,7 +140,7 @@ assert_eq!(
140
140
## Place Expressions and Value Expressions
141
141
142
142
Expressions are divided into two main categories: place expressions and
143
- value expressions. Likewise within each expression, operands may occur
143
+ value expressions. Likewise, within each expression, operands may occur
144
144
in either place context or value context. The evaluation of an expression
145
145
depends both on its own category and the context it occurs within.
146
146
@@ -173,7 +173,7 @@ The following contexts are *place expression* contexts:
173
173
When a place expression is evaluated in a value expression context, or is bound
174
174
by value in a pattern, it denotes the value held _ in_ that memory location. If
175
175
the type of that value implements [ ` Copy ` ] , then the value will be copied. In
176
- the remaining situations if that type is [ ` Sized ` ] , then it may be possible to
176
+ the remaining situations, if that type is [ ` Sized ` ] , then it may be possible to
177
177
move the value. Only the following place expressions may be moved out of:
178
178
179
179
* [ Variables] which are not currently borrowed.
@@ -183,46 +183,46 @@ move the value. Only the following place expressions may be moved out of:
183
183
* The result of [ dereferencing] [ deref ] an expression with type [ ` Box<T> ` ] and
184
184
that can also be moved out of.
185
185
186
- Moving out of a place expression that evaluates to a local variable, the
186
+ When moving out of a place expression that evaluates to a local variable, the
187
187
location is deinitialized and cannot be read from again until it is
188
188
reinitialized. In all other cases, trying to use a place expression in a value
189
189
expression context is an error.
190
190
191
191
### Mutability
192
192
193
193
For a place expression to be [ assigned] [ assign ] to, mutably [ borrowed] [ borrow ] ,
194
- [ implicitly mutably borrowed] , or bound to a pattern containing ` ref mut ` it
194
+ [ implicitly mutably borrowed] , or bound to a pattern containing ` ref mut ` , it
195
195
must be _ mutable_ . We call these * mutable place expressions* . In contrast,
196
196
other place expressions are called * immutable place expressions* .
197
197
198
198
The following expressions can be mutable place expression contexts:
199
199
200
- * Mutable [ variables] , which are not currently borrowed.
200
+ * Mutable [ variables] which are not currently borrowed.
201
201
* [ Mutable ` static ` items] .
202
202
* [ Temporary values] .
203
- * [ Fields] [ field ] , this evaluates the subexpression in a mutable place
203
+ * [ Fields] [ field ] : this evaluates the subexpression in a mutable place
204
204
expression context.
205
205
* [ Dereferences] [ deref ] of a ` *mut T ` pointer.
206
206
* Dereference of a variable, or field of a variable, with type ` &mut T ` . Note:
207
207
This is an exception to the requirement of the next rule.
208
- * Dereferences of a type that implements ` DerefMut ` , this then requires that
208
+ * Dereferences of a type that implements ` DerefMut ` : this then requires that
209
209
the value being dereferenced is evaluated is a mutable place expression context.
210
- * [ Array indexing] of a type that implements ` IndexMut ` , this
210
+ * [ Array indexing] of a type that implements ` IndexMut ` : this
211
211
then evaluates the value being indexed, but not the index, in mutable place
212
212
expression context.
213
213
214
214
### Temporaries
215
215
216
216
When using a value expression in most place expression contexts, a temporary
217
- unnamed memory location is created initialized to that value and the expression
217
+ unnamed memory location is created and initialized to that value. The expression
218
218
evaluates to that location instead, except if [ promoted] to a ` static ` . The
219
219
[ drop scope] of the temporary is usually the end of the enclosing statement.
220
220
221
221
### Implicit Borrows
222
222
223
223
Certain expressions will treat an expression as a place expression by implicitly
224
224
borrowing it. For example, it is possible to compare two unsized [ slices] [ slice ] for
225
- equality directly, because the ` == ` operator implicitly borrows it's operands:
225
+ equality directly, because the ` == ` operator implicitly borrows its operands:
226
226
227
227
``` rust
228
228
# let c = [1 , 2 , 3 ];
0 commit comments