Skip to content

Commit 02fd202

Browse files
committed
Uses ptr::from_ref in pi_mutex.rs
We have new API for casting now.
1 parent 29f3341 commit 02fd202

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

library/std/src/sys/pal/unix/pi_futex.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#![cfg(any(target_os = "linux", target_os = "android"))]
22

3-
use crate::io;
4-
use crate::ptr::null;
53
use crate::sync::atomic::AtomicU32;
64
use crate::sys::cvt;
5+
use crate::{io, ptr};
76

87
pub const fn unlocked() -> u32 {
98
0
@@ -26,10 +25,10 @@ pub fn futex_lock(futex: &AtomicU32) -> io::Result<()> {
2625
match cvt(unsafe {
2726
libc::syscall(
2827
libc::SYS_futex,
29-
futex as *const AtomicU32,
28+
ptr::from_ref(futex),
3029
libc::FUTEX_LOCK_PI | libc::FUTEX_PRIVATE_FLAG,
3130
0,
32-
null::<u32>(),
31+
ptr::null::<u32>(),
3332
// remaining args are unused
3433
)
3534
}) {
@@ -44,7 +43,7 @@ pub fn futex_unlock(futex: &AtomicU32) -> io::Result<()> {
4443
cvt(unsafe {
4544
libc::syscall(
4645
libc::SYS_futex,
47-
futex as *const AtomicU32,
46+
ptr::from_ref(futex),
4847
libc::FUTEX_UNLOCK_PI | libc::FUTEX_PRIVATE_FLAG,
4948
// remaining args are unused
5049
)

0 commit comments

Comments
 (0)