soft-deprecate the addr_of macros

This commit is contained in:
Ralf Jung 2024-07-13 13:56:05 +02:00
parent 79503dd742
commit b8464961a2
1 changed files with 6 additions and 0 deletions

View File

@ -2209,6 +2209,9 @@ impl<F: FnPtr> fmt::Debug for F {
/// Creates a `const` raw pointer to a place, without creating an intermediate reference. /// 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 /// 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, /// 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 /// raw pointers should be used instead. However, `&expr as *const _` creates a reference
@ -2283,6 +2286,9 @@ pub macro addr_of($place:expr) {
/// Creates a `mut` raw pointer to a place, without creating an intermediate reference. /// 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 /// 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, /// 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 /// raw pointers should be used instead. However, `&mut expr as *mut _` creates a reference