diff options
| author | Ralf Jung <post@ralfj.de> | 2024-07-13 13:56:05 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-08-18 19:46:53 +0200 |
| commit | b8464961a2681585a6231b93cd7e85e50022c2b3 (patch) | |
| tree | 82d197e56c92091ee14ec2efce9de8c689072380 | |
| parent | 79503dd742253cdca54f10aec9052ff477ccaf38 (diff) | |
| download | rust-b8464961a2681585a6231b93cd7e85e50022c2b3.tar.gz rust-b8464961a2681585a6231b93cd7e85e50022c2b3.zip | |
soft-deprecate the addr_of macros
| -rw-r--r-- | library/core/src/ptr/mod.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index 25d8f4a0adb..3fe5212cea7 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -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 @@ -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 |
