Skip to content

Commit 9d2f469

Browse files
committed
soft-deprecate the addr_of macros
1 parent 1e5337d commit 9d2f469

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

library/core/src/ptr/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -2209,6 +2209,9 @@ impl<F: FnPtr> fmt::Debug for F {
22092209

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

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

0 commit comments

Comments
 (0)