Skip to content

Commit 1debc80

Browse files
committed
tweaks
1 parent 01fac39 commit 1debc80

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/expressions/operator-expr.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ let a = & & & & mut 10;
7272

7373
### Raw address-of operators
7474

75-
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)`.
75+
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].
7676
The expression `expr` is evaluated in place expression context.
77-
`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`.
77+
`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`.
7878

7979
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.
8080
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.
@@ -539,6 +539,8 @@ See [this test] for an example of using this dependency.
539539
[Function pointer]: ../types/function-pointer.md
540540
[Function item]: ../types/function-item.md
541541
[undefined behavior]: ../behavior-considered-undefined.md
542+
[addr_of]: ../../std/ptr/macro.addr_of.html
543+
[addr_of_mut]: ../../std/ptr/macro.addr_of_mut.html
542544

543545
[_BorrowExpression_]: #borrow-operators
544546
[_DereferenceExpression_]: #the-dereference-operator

0 commit comments

Comments
 (0)