Skip to content

Commit 069b996

Browse files
committed
soft-deprecate the addr_of macros
1 parent 6a8a06c commit 069b996

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
@@ -2136,6 +2136,9 @@ impl<F: FnPtr> fmt::Debug for F {
21362136

21372137
/// Create a `const` raw pointer to a place, without creating an intermediate reference.
21382138
///
2139+
/// `addr_of!(expr)` is equivalent to `&raw const expr`. The macro is *soft-deprecated*;
2140+
/// use `&raw const` instead.
2141+
///
21392142
/// Creating a reference with `&`/`&mut` is only allowed if the pointer is properly aligned
21402143
/// and points to initialized data. For cases where those requirements do not hold,
21412144
/// raw pointers should be used instead. However, `&expr as *const _` creates a reference
@@ -2210,6 +2213,9 @@ pub macro addr_of($place:expr) {
22102213

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

0 commit comments

Comments
 (0)