@@ -1989,9 +1989,13 @@ impl<F: FnPtr> fmt::Debug for F {
19891989/// as all other references. This macro can create a raw pointer *without* creating
19901990/// a reference first.
19911991///
1992- /// Note, however, that the `expr` in `addr_of!(expr)` is still subject to all
1993- /// the usual rules. In particular, `addr_of!(*ptr::null())` is Undefined
1994- /// Behavior because it dereferences a null pointer.
1992+ /// The `expr` in `addr_of!(expr)` is evaluated as a place expression, but never loads
1993+ /// from the place or requires the place to be dereferenceable. This means that
1994+ /// `addr_of!(*ptr)` is defined behavior even if `ptr` is dangling or misaligned.
1995+ /// Note however that `addr_of!((*ptr).field)` still requires the projection to
1996+ /// `field` to be in-bounds, using the same rules as [`offset`].
1997+ ///
1998+ /// [`offset`]: pointer::offset
19951999///
19962000/// # Example
19972001///
@@ -2029,9 +2033,13 @@ pub macro addr_of($place:expr) {
20292033/// as all other references. This macro can create a raw pointer *without* creating
20302034/// a reference first.
20312035///
2032- /// Note, however, that the `expr` in `addr_of_mut!(expr)` is still subject to all
2033- /// the usual rules. In particular, `addr_of_mut!(*ptr::null_mut())` is Undefined
2034- /// Behavior because it dereferences a null pointer.
2036+ /// The `expr` in `addr_of_mut!(expr)` is evaluated as a place expression, but never loads
2037+ /// from the place or requires the place to be dereferenceable. This means that
2038+ /// `addr_of_mut!(*ptr)` is defined behavior even if `ptr` is dangling or misaligned.
2039+ /// Note however that `addr_of_mut!((*ptr).field)` still requires the projection to
2040+ /// `field` to be in-bounds, using the same rules as [`offset`].
2041+ ///
2042+ /// [`offset`]: pointer::offset
20352043///
20362044/// # Examples
20372045///
0 commit comments