Skip to content

Commit

Permalink
soft-deprecate the addr_of macros
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Aug 18, 2024
1 parent bd7aa57 commit 8bdd95b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/src/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2209,6 +2209,9 @@ impl<F: FnPtr> fmt::Debug for F {

/// Creates a `const` raw pointer to a place, without creating an intermediate reference.
///
/// `addr_of!(expr)` is equivalent to `&raw const expr`. The macro is *soft-deprecated*;
/// use `&raw const` instead.
///
/// Creating a reference with `&`/`&mut` is only allowed if the pointer is properly aligned
/// and points to initialized data. For cases where those requirements do not hold,
/// raw pointers should be used instead. However, `&expr as *const _` creates a reference
Expand Down Expand Up @@ -2283,6 +2286,9 @@ pub macro addr_of($place:expr) {

/// Creates a `mut` raw pointer to a place, without creating an intermediate reference.
///
/// `addr_of_mut!(expr)` is equivalent to `&raw mut expr`. The macro is *soft-deprecated*;
/// use `&raw mut` instead.
///
/// Creating a reference with `&`/`&mut` is only allowed if the pointer is properly aligned
/// and points to initialized data. For cases where those requirements do not hold,
/// raw pointers should be used instead. However, `&mut expr as *mut _` creates a reference
Expand Down

0 comments on commit 8bdd95b

Please sign in to comment.