File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -563,11 +563,11 @@ impl () {}
563
563
/// Note that here the call to [`drop`] is for clarity - it indicates
564
564
/// that we are done with the given value and it should be destroyed.
565
565
///
566
- /// ## 3. Create it using `ptr::addr_of! `
566
+ /// ## 3. Create it using `&raw `
567
567
///
568
- /// Instead of coercing a reference to a raw pointer, you can use the macros
569
- /// [`ptr::addr_of!`] (for `*const T`) and [`ptr::addr_of_mut!`] (for `*mut T`).
570
- /// These macros allow you to create raw pointers to fields to which you cannot
568
+ /// Instead of coercing a reference to a raw pointer, you can use the raw borrow
569
+ /// operators `&raw const` (for `*const T`) and `&raw mut` (for `*mut T`).
570
+ /// These operators allow you to create raw pointers to fields to which you cannot
571
571
/// create a reference (without causing undefined behavior), such as an
572
572
/// unaligned field. This might be necessary if packed structs or uninitialized
573
573
/// memory is involved.
@@ -580,7 +580,7 @@ impl () {}
580
580
/// unaligned: u32,
581
581
/// }
582
582
/// let s = S::default();
583
- /// let p = std::ptr::addr_of!( s.unaligned) ; // not allowed with coercion
583
+ /// let p = &raw const s.unaligned; // not allowed with coercion
584
584
/// ```
585
585
///
586
586
/// ## 4. Get it from C.
You can’t perform that action at this time.
0 commit comments