Skip to content

Commit ab60513

Browse files
authored
Merge pull request #1057 from tlyu/expressions-grammar-fixes
fix grammar in Expressions
2 parents 15de161 + 97ba67c commit ab60513

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/expressions.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ assert_eq!(
140140
## Place Expressions and Value Expressions
141141

142142
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
144144
in either place context or value context. The evaluation of an expression
145145
depends both on its own category and the context it occurs within.
146146

@@ -173,7 +173,7 @@ The following contexts are *place expression* contexts:
173173
When a place expression is evaluated in a value expression context, or is bound
174174
by value in a pattern, it denotes the value held _in_ that memory location. If
175175
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
177177
move the value. Only the following place expressions may be moved out of:
178178

179179
* [Variables] which are not currently borrowed.
@@ -183,46 +183,46 @@ move the value. Only the following place expressions may be moved out of:
183183
* The result of [dereferencing][deref] an expression with type [`Box<T>`] and
184184
that can also be moved out of.
185185

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
187187
location is deinitialized and cannot be read from again until it is
188188
reinitialized. In all other cases, trying to use a place expression in a value
189189
expression context is an error.
190190

191191
### Mutability
192192

193193
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
195195
must be _mutable_. We call these *mutable place expressions*. In contrast,
196196
other place expressions are called *immutable place expressions*.
197197

198198
The following expressions can be mutable place expression contexts:
199199

200-
* Mutable [variables], which are not currently borrowed.
200+
* Mutable [variables] which are not currently borrowed.
201201
* [Mutable `static` items].
202202
* [Temporary values].
203-
* [Fields][field], this evaluates the subexpression in a mutable place
203+
* [Fields][field]: this evaluates the subexpression in a mutable place
204204
expression context.
205205
* [Dereferences][deref] of a `*mut T` pointer.
206206
* Dereference of a variable, or field of a variable, with type `&mut T`. Note:
207207
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
209209
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
211211
then evaluates the value being indexed, but not the index, in mutable place
212212
expression context.
213213

214214
### Temporaries
215215

216216
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
218218
evaluates to that location instead, except if [promoted] to a `static`. The
219219
[drop scope] of the temporary is usually the end of the enclosing statement.
220220

221221
### Implicit Borrows
222222

223223
Certain expressions will treat an expression as a place expression by implicitly
224224
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:
226226

227227
```rust
228228
# let c = [1, 2, 3];

0 commit comments

Comments
 (0)