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 Jul 14, 2024
1 parent 6a8a06c commit 069b996
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions library/core/src/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2136,6 +2136,9 @@ impl<F: FnPtr> fmt::Debug for F {

/// Create 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 @@ -2210,6 +2213,9 @@ pub macro addr_of($place:expr) {

/// Create 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 069b996

Please sign in to comment.