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/std/src/sys/pal/unix/thread.rs | |
| parent | 8f359beca4e58bc3ae795a666301a8f47023044c (diff) | |
| download | rust-ff187a92d84f352670a9a63e8519eac114456d38.tar.gz rust-ff187a92d84f352670a9a63e8519eac114456d38.zip | |
library: use `addr_of!`
Diffstat (limited to 'library/std/src/sys/pal/unix/thread.rs')
| -rw-r--r-- | library/std/src/sys/pal/unix/thread.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/library/std/src/sys/pal/unix/thread.rs b/library/std/src/sys/pal/unix/thread.rs index 97976407bb4..864de31c6eb 100644 --- a/library/std/src/sys/pal/unix/thread.rs +++ b/library/std/src/sys/pal/unix/thread.rs @@ -239,7 +239,7 @@ impl Thread { tv_nsec: nsecs, }; secs -= ts.tv_sec as u64; - let ts_ptr = &mut ts as *mut _; + let ts_ptr = core::ptr::addr_of_mut!(ts); if libc::nanosleep(ts_ptr, ts_ptr) == -1 { assert_eq!(os::errno(), libc::EINTR); secs += ts.tv_sec as u64; @@ -418,8 +418,8 @@ pub fn available_parallelism() -> io::Result<NonZero<usize>> { libc::sysctl( mib.as_mut_ptr(), 2, - &mut cpus as *mut _ as *mut _, - &mut cpus_size as *mut _ as *mut _, + core::ptr::addr_of_mut!(cpus) as *mut _, + core::ptr::addr_of_mut!(cpus_size) as *mut _, ptr::null_mut(), 0, ) @@ -864,7 +864,7 @@ pub mod guard { .unwrap(); match sysctlbyname.get() { Some(fcn) => { - if fcn(oid.as_ptr(), &mut guard as *mut _ as *mut _, &mut size as *mut _ as *mut _, crate::ptr::null_mut(), 0) == 0 { + if fcn(oid.as_ptr(), core::ptr::addr_of_mut!(guard) as *mut _, core::ptr::addr_of_mut!(size) as *mut _, crate::ptr::null_mut(), 0) == 0 { return guard; } return 1; |
