Skip to content

Commit 9b4e40d

Browse files
authored
Rollup merge of #134630 - fifty-six:master, r=workingjubilee
Use `&raw` for `ptr` primitive docs Fixes the first item in #133024
2 parents 239b7e8 + 4663352 commit 9b4e40d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: library/core/src/primitive_docs.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -563,11 +563,11 @@ impl () {}
563563
/// Note that here the call to [`drop`] is for clarity - it indicates
564564
/// that we are done with the given value and it should be destroyed.
565565
///
566-
/// ## 3. Create it using `ptr::addr_of!`
566+
/// ## 3. Create it using `&raw`
567567
///
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
571571
/// create a reference (without causing undefined behavior), such as an
572572
/// unaligned field. This might be necessary if packed structs or uninitialized
573573
/// memory is involved.
@@ -580,7 +580,7 @@ impl () {}
580580
/// unaligned: u32,
581581
/// }
582582
/// 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
584584
/// ```
585585
///
586586
/// ## 4. Get it from C.

0 commit comments

Comments
 (0)