@@ -1407,9 +1407,8 @@ pub const unsafe fn read<T>(src: *const T) -> T {
14071407/// As a result, using `&packed.unaligned as *const FieldType` causes immediate
14081408/// *undefined behavior* in your program.
14091409///
1410- /// Instead you must use the [`ptr::addr_of!`](addr_of) macro to
1411- /// create the pointer. You may use that returned pointer together with this
1412- /// function.
1410+ /// Instead you must use the `&raw const` syntax to create the pointer.
1411+ /// You may use that constructed pointer together with this function.
14131412///
14141413/// An example of what not to do and how this relates to `read_unaligned` is:
14151414///
@@ -1427,7 +1426,7 @@ pub const unsafe fn read<T>(src: *const T) -> T {
14271426///
14281427/// // Take the address of a 32-bit integer which is not aligned.
14291428/// // In contrast to `&packed.unaligned as *const _`, this has no undefined behavior.
1430- /// let unaligned = std::ptr::addr_of!( packed.unaligned) ;
1429+ /// let unaligned = &raw const packed.unaligned;
14311430///
14321431/// let v = unsafe { std::ptr::read_unaligned(unaligned) };
14331432/// assert_eq!(v, 0x01020304);
@@ -1615,9 +1614,8 @@ pub const unsafe fn write<T>(dst: *mut T, src: T) {
16151614/// As a result, using `&packed.unaligned as *const FieldType` causes immediate
16161615/// *undefined behavior* in your program.
16171616///
1618- /// Instead, you must use the [`ptr::addr_of_mut!`](addr_of_mut)
1619- /// macro to create the pointer. You may use that returned pointer together with
1620- /// this function.
1617+ /// Instead, you must use the `&raw mut` syntax to create the pointer.
1618+ /// You may use that constructed pointer together with this function.
16211619///
16221620/// An example of how to do it and how this relates to `write_unaligned` is:
16231621///
@@ -1632,7 +1630,7 @@ pub const unsafe fn write<T>(dst: *mut T, src: T) {
16321630///
16331631/// // Take the address of a 32-bit integer which is not aligned.
16341632/// // In contrast to `&packed.unaligned as *mut _`, this has no undefined behavior.
1635- /// let unaligned = std::ptr::addr_of_mut!( packed.unaligned) ;
1633+ /// let unaligned = &raw mut packed.unaligned;
16361634///
16371635/// unsafe { std::ptr::write_unaligned(unaligned, 42) };
16381636///
0 commit comments