diff options
| author | Pavel Grigorenko <grigorenkopv@ya.ru> | 2024-02-24 16:02:17 +0300 |
|---|---|---|
| committer | Pavel Grigorenko <grigorenkopv@ya.ru> | 2024-02-24 16:02:17 +0300 |
| commit | ff187a92d84f352670a9a63e8519eac114456d38 (patch) | |
| tree | bb16e4e323011af089b5e934ca5a765216567047 /library/core/src/ptr/mod.rs | |
| parent | 8f359beca4e58bc3ae795a666301a8f47023044c (diff) | |
| download | rust-ff187a92d84f352670a9a63e8519eac114456d38.tar.gz rust-ff187a92d84f352670a9a63e8519eac114456d38.zip | |
library: use `addr_of!`
Diffstat (limited to 'library/core/src/ptr/mod.rs')
| -rw-r--r-- | library/core/src/ptr/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index 90b3341f0ad..fc5b08c9801 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -1553,7 +1553,7 @@ pub const unsafe fn write_unaligned<T>(dst: *mut T, src: T) { // `dst` cannot overlap `src` because the caller has mutable access // to `dst` while `src` is owned by this function. unsafe { - copy_nonoverlapping(&src as *const T as *const u8, dst as *mut u8, mem::size_of::<T>()); + copy_nonoverlapping(addr_of!(src) as *const u8, dst as *mut u8, mem::size_of::<T>()); // We are calling the intrinsic directly to avoid function calls in the generated code. intrinsics::forget(src); } |
