Skip to content

Commit 3501d85

Browse files
RalfJungjoshtriplett
authored andcommitted
edits
1 parent 39b8157 commit 3501d85

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Diff for: src/expressions.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ A *value expression* is an expression that represents an actual value.
157157
The following contexts are *place expression* contexts:
158158

159159
* The left operand of a [compound assignment] expression.
160-
* The operand of a unary [borrow] or [dereference][deref] operator.
160+
* The operand of a unary [borrow], [address-of][addr-of] or [dereference][deref] operator.
161161
* The operand of a field expression.
162162
* The indexed operand of an array indexing expression.
163163
* The operand of any [implicit borrow].
@@ -308,6 +308,7 @@ They are never allowed before:
308308

309309
[assign]: expressions/operator-expr.md#assignment-expressions
310310
[borrow]: expressions/operator-expr.md#borrow-operators
311+
[addr-of]: expressions/operator-expr.md#raw-address-of-operators
311312
[comparison]: expressions/operator-expr.md#comparison-operators
312313
[compound assignment]: expressions/operator-expr.md#compound-assignment-expressions
313314
[deref]: expressions/operator-expr.md#the-dereference-operator

Diff for: src/expressions/operator-expr.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ let a = & & & & mut 10;
8282
### Raw address-of operators
8383

8484
Related to the borrow operators are the *raw address-of operators*, which do not have first-class syntax, but are exposed via the macros `ptr::addr_of!(expr)` and `ptr::addr_of_mut!(expr)`.
85-
Like with `&`/`&mut`, the expression is evaluated in place expression context.
85+
Like with `&`/`&mut`, the expression `expr` is evaluated in place expression context.
8686
The difference is that `&`/`&mut` create *references* of type `&T`/`&mut T`, while `ptr::addr_of!(expr)` creates a (const) raw pointer of type `*const T` and `ptr::addr_of_mut!(expr)` creates a mutable raw pointer of type `*mut T`.
8787

8888
The raw address-of operators must be used whenever the place expression could evaluate to a place that is not properly aligned or does not store a valid value as determined by its type.

0 commit comments

Comments
 (0)