Skip to content

Commit 5bf665d

Browse files
committed
tweaks
1 parent 74f4082 commit 5bf665d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/expressions/operator-expr.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ let a = & & & & mut 10;
7373

7474
### Raw address-of operators
7575

76-
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+
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)`][addr_of] and [`ptr::addr_of_mut!(expr)`][addr_of_mut].
7777
The expression `expr` is evaluated in place expression context.
78-
`ptr::addr_of!(expr)` then creates a (const) raw pointer of type `*const T` to the given place, and `ptr::addr_of_mut!(expr)` creates a mutable raw pointer of type `*mut T`.
78+
`ptr::addr_of!(expr)` then creates a const raw pointer of type `*const T` to the given place, and `ptr::addr_of_mut!(expr)` creates a mutable raw pointer of type `*mut T`.
7979

8080
The raw address-of operators must be used instead of a borrow operator 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, or whenever creating a reference would introduce incorrect aliasing assumptions.
8181
In those situations, using a borrow operator would cause [undefined behavior] by creating an invalid reference, but a raw pointer may still be constructed using an address-of operator.
@@ -640,6 +640,8 @@ See [this test] for an example of using this dependency.
640640
[Function pointer]: ../types/function-pointer.md
641641
[Function item]: ../types/function-item.md
642642
[undefined behavior]: ../behavior-considered-undefined.md
643+
[addr_of]: ../../std/ptr/macro.addr_of.html
644+
[addr_of_mut]: ../../std/ptr/macro.addr_of_mut.html
643645

644646
[_BorrowExpression_]: #borrow-operators
645647
[_DereferenceExpression_]: #the-dereference-operator

0 commit comments

Comments
 (0)