Skip to content

Commit a775f10

Browse files
committed
edits
1 parent b92eb82 commit a775f10

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/expressions.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ The following contexts are *place expression* contexts:
156156

157157
* The left operand of an [assignment][assign] or [compound assignment]
158158
expression.
159-
* The operand of a unary [borrow] or [dereference][deref] operator.
159+
* The operand of a unary [borrow], [address-of][addr-of], or [dereference][deref] operator.
160160
* The operand of a field expression.
161161
* The indexed operand of an array indexing expression.
162162
* The operand of any [implicit borrow].
@@ -293,6 +293,7 @@ They are never allowed before:
293293

294294
[assign]: expressions/operator-expr.md#assignment-expressions
295295
[borrow]: expressions/operator-expr.md#borrow-operators
296+
[addr-of]: expressions/operator-expr.md#raw-address-of-operators
296297
[comparison]: expressions/operator-expr.md#comparison-operators
297298
[compound assignment]: expressions/operator-expr.md#compound-assignment-expressions
298299
[deref]: expressions/operator-expr.md#the-dereference-operator

src/expressions/operator-expr.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ let a = & & & & mut 10;
7373
### Raw address-of operators
7474

7575
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)`.
76-
Like with `&`/`&mut`, the expression is evaluated in place expression context.
76+
Like with `&`/`&mut`, the expression `expr` is evaluated in place expression context.
7777
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`.
7878

7979
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)