Skip to content

Commit 5c4a7a6

Browse files
RalfJungjoshtriplett
authored andcommitted
tweaks
1 parent 9b5148c commit 5c4a7a6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

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

8282
### Raw address-of operators
8383

84-
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)`.
84+
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].
8585
The expression `expr` is evaluated in place expression context.
86-
`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`.
86+
`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`.
8787

8888
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.
8989
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.
@@ -650,6 +650,8 @@ See [this test] for an example of using this dependency.
650650
[Function pointer]: ../types/function-pointer.md
651651
[Function item]: ../types/function-item.md
652652
[undefined behavior]: ../behavior-considered-undefined.md
653+
[addr_of]: ../../std/ptr/macro.addr_of.html
654+
[addr_of_mut]: ../../std/ptr/macro.addr_of_mut.html
653655

654656
[_BorrowExpression_]: #borrow-operators
655657
[_DereferenceExpression_]: #the-dereference-operator

0 commit comments

Comments
 (0)