Use as_mut_ptr instead of casts
This commit is contained in:
parent
3b1c742e23
commit
23c5e584e0
4 changed files with 6 additions and 5 deletions
|
@ -234,6 +234,7 @@
|
|||
#![feature(allocator_internals)]
|
||||
#![feature(allow_internal_unsafe)]
|
||||
#![feature(allow_internal_unstable)]
|
||||
#![feature(atomic_mut_ptr)]
|
||||
#![feature(arbitrary_self_types)]
|
||||
#![feature(array_error_internals)]
|
||||
#![feature(asm)]
|
||||
|
|
|
@ -67,7 +67,7 @@ mod lock {
|
|||
//
|
||||
// unsafe {
|
||||
// let r = core::arch::wasm32::i32_atomic_wait(
|
||||
// &LOCKED as *const AtomicI32 as *mut i32,
|
||||
// LOCKED.as_mut_ptr(),
|
||||
// 1, // expected value
|
||||
// -1, // timeout
|
||||
// );
|
||||
|
@ -143,7 +143,7 @@ mod lock {
|
|||
//
|
||||
// unsafe {
|
||||
// core::arch::wasm32::atomic_notify(
|
||||
// &LOCKED as *const AtomicI32 as *mut i32,
|
||||
// LOCKED.as_mut_ptr(),
|
||||
// 1, // only one thread
|
||||
// );
|
||||
// }
|
||||
|
|
|
@ -89,6 +89,6 @@ impl Condvar {
|
|||
#[inline]
|
||||
fn ptr(&self) -> *mut i32 {
|
||||
assert_eq!(mem::size_of::<usize>(), mem::size_of::<i32>());
|
||||
&self.cnt as *const AtomicUsize as *mut i32
|
||||
self.cnt.as_mut_ptr() as *mut i32
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ impl Mutex {
|
|||
#[inline]
|
||||
fn ptr(&self) -> *mut i32 {
|
||||
assert_eq!(mem::size_of::<usize>(), mem::size_of::<i32>());
|
||||
&self.locked as *const AtomicUsize as *mut isize as *mut i32
|
||||
self.locked.as_mut_ptr() as *mut i32
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,6 +145,6 @@ impl ReentrantMutex {
|
|||
|
||||
#[inline]
|
||||
fn ptr(&self) -> *mut i32 {
|
||||
&self.owner as *const AtomicU32 as *mut i32
|
||||
self.owner.as_mut_ptr() as *mut i32
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue