Remove uses of mem::uninitialized()
from cloudabi
This commit is contained in:
parent
1cdcea920e
commit
6e8639a418
5 changed files with 18 additions and 14 deletions
|
@ -115,6 +115,7 @@
|
|||
|
||||
#![no_std]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(deprecated)] // FIXME: using `mem::uninitialized()`
|
||||
|
||||
include!("bitflags.rs");
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![allow(deprecated)] // mem::uninitialized
|
||||
|
||||
use crate::io::ErrorKind;
|
||||
use crate::mem;
|
||||
|
||||
|
|
|
@ -104,10 +104,11 @@ impl ReentrantMutex {
|
|||
},
|
||||
..mem::zeroed()
|
||||
};
|
||||
let mut event: abi::event = mem::uninitialized();
|
||||
let mut nevents: usize = mem::uninitialized();
|
||||
let ret = abi::poll(&subscription, &mut event, 1, &mut nevents);
|
||||
let mut event = MaybeUninit::<abi::event>::uninit();
|
||||
let mut nevents = MaybeUninit::<usize>::uninit();
|
||||
let ret = abi::poll(&subscription, event.as_mut_ptr(), 1, nevents.as_mut_ptr());
|
||||
assert_eq!(ret, abi::errno::SUCCESS, "Failed to acquire mutex");
|
||||
let event = event.assume_init();
|
||||
assert_eq!(event.error, abi::errno::SUCCESS, "Failed to acquire mutex");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use crate::cell::UnsafeCell;
|
||||
use crate::mem;
|
||||
use crate::mem::MaybeUninit;
|
||||
use crate::sync::atomic::{AtomicU32, Ordering};
|
||||
use crate::sys::cloudabi::abi;
|
||||
|
||||
|
@ -73,10 +74,11 @@ impl RWLock {
|
|||
},
|
||||
..mem::zeroed()
|
||||
};
|
||||
let mut event: abi::event = mem::uninitialized();
|
||||
let mut nevents: usize = mem::uninitialized();
|
||||
let ret = abi::poll(&subscription, &mut event, 1, &mut nevents);
|
||||
let mut event = MaybeUninit::<abi::event>::uninit();
|
||||
let mut nevents = MaybeUninit::<usize>::uninit();
|
||||
let ret = abi::poll(&subscription, event.as_mut_ptr(), 1, nevents.as_mut_ptr());
|
||||
assert_eq!(ret, abi::errno::SUCCESS, "Failed to acquire read lock");
|
||||
let event = event.assume_init();
|
||||
assert_eq!(
|
||||
event.error,
|
||||
abi::errno::SUCCESS,
|
||||
|
@ -182,10 +184,11 @@ impl RWLock {
|
|||
},
|
||||
..mem::zeroed()
|
||||
};
|
||||
let mut event: abi::event = mem::uninitialized();
|
||||
let mut nevents: usize = mem::uninitialized();
|
||||
let ret = abi::poll(&subscription, &mut event, 1, &mut nevents);
|
||||
let mut event = MaybeUninit::<abi::event>::uninit();
|
||||
let mut nevents = MaybeUninit::<usize>::uninit();
|
||||
let ret = abi::poll(&subscription, event.as_mut_ptr(), 1, nevents.as_mut_ptr());
|
||||
assert_eq!(ret, abi::errno::SUCCESS, "Failed to acquire write lock");
|
||||
let event = event.assume_init();
|
||||
assert_eq!(
|
||||
event.error,
|
||||
abi::errno::SUCCESS,
|
||||
|
|
|
@ -72,10 +72,11 @@ impl Thread {
|
|||
},
|
||||
..mem::zeroed()
|
||||
};
|
||||
let mut event: abi::event = mem::uninitialized();
|
||||
let mut nevents: usize = mem::uninitialized();
|
||||
let ret = abi::poll(&subscription, &mut event, 1, &mut nevents);
|
||||
let mut event = mem::MaybeUninit::<abi::event>::uninit();
|
||||
let mut nevents = mem::MaybeUninit::<usize>::uninit();
|
||||
let ret = abi::poll(&subscription, event.as_mut_ptr(), 1, nevents.as_mut_ptr());
|
||||
assert_eq!(ret, abi::errno::SUCCESS);
|
||||
let event = event.assume_init();
|
||||
assert_eq!(event.error, abi::errno::SUCCESS);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue