fix some uses I missed
This commit is contained in:
parent
0e0383abc6
commit
853ae8d931
@ -28,7 +28,7 @@ const ENCLU_EGETKEY: u32 = 1;
|
||||
#[unstable(feature = "sgx_platform", issue = "56975")]
|
||||
pub fn egetkey(request: &Align512<[u8; 512]>) -> Result<Align16<[u8; 16]>, u32> {
|
||||
unsafe {
|
||||
let mut out = MaybeUninit::uninitialized();
|
||||
let mut out = MaybeUninit::uninit();
|
||||
let error;
|
||||
|
||||
asm!(
|
||||
@ -41,7 +41,7 @@ pub fn egetkey(request: &Align512<[u8; 512]>) -> Result<Align16<[u8; 16]>, u32>
|
||||
);
|
||||
|
||||
match error {
|
||||
0 => Ok(out.into_initialized()),
|
||||
0 => Ok(out.assume_init()),
|
||||
err => Err(err),
|
||||
}
|
||||
}
|
||||
@ -58,7 +58,7 @@ pub fn ereport(
|
||||
reportdata: &Align128<[u8; 64]>,
|
||||
) -> Align512<[u8; 432]> {
|
||||
unsafe {
|
||||
let mut report = MaybeUninit::uninitialized();
|
||||
let mut report = MaybeUninit::uninit();
|
||||
|
||||
asm!(
|
||||
"enclu"
|
||||
@ -69,6 +69,6 @@ pub fn ereport(
|
||||
"{rdx}"(report.as_mut_ptr())
|
||||
);
|
||||
|
||||
report.into_initialized()
|
||||
report.assume_init()
|
||||
}
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ mod tests {
|
||||
let mut init = MaybeUninit::<RWLock>::zeroed();
|
||||
rwlock_new(&mut init);
|
||||
assert_eq!(
|
||||
mem::transmute::<_, [u8; 128]>(init.into_initialized()).as_slice(),
|
||||
mem::transmute::<_, [u8; 128]>(init.assume_init()).as_slice(),
|
||||
RWLOCK_INIT
|
||||
)
|
||||
};
|
||||
|
@ -154,7 +154,7 @@ unsafe impl Sync for ReentrantMutex {}
|
||||
|
||||
impl ReentrantMutex {
|
||||
pub fn uninitialized() -> ReentrantMutex {
|
||||
ReentrantMutex { inner: UnsafeCell::new(MaybeUninit::uninitialized()) }
|
||||
ReentrantMutex { inner: UnsafeCell::new(MaybeUninit::uninit()) }
|
||||
}
|
||||
|
||||
pub unsafe fn init(&mut self) {
|
||||
|
@ -12,5 +12,8 @@ pub fn box_uninitialized() -> Box<MaybeUninit<usize>> {
|
||||
// CHECK-NOT: alloca
|
||||
// CHECK-NOT: memcpy
|
||||
// CHECK-NOT: memset
|
||||
Box::new(MaybeUninit::uninitialized())
|
||||
Box::new(MaybeUninit::uninit())
|
||||
}
|
||||
|
||||
// FIXME: add a test for a bigger box. Currently broken, see
|
||||
// https://github.com/rust-lang/rust/issues/58201.
|
||||
|
@ -36,7 +36,7 @@ fn main() {
|
||||
|
||||
assert_eq!(
|
||||
panic::catch_unwind(|| {
|
||||
mem::MaybeUninit::<!>::uninitialized().into_initialized()
|
||||
mem::MaybeUninit::<!>::uninit().assume_init()
|
||||
}).err().and_then(|a| a.downcast_ref::<String>().map(|s| {
|
||||
s == "Attempted to instantiate uninhabited type !"
|
||||
})),
|
||||
@ -63,7 +63,7 @@ fn main() {
|
||||
|
||||
assert_eq!(
|
||||
panic::catch_unwind(|| {
|
||||
mem::MaybeUninit::<Foo>::uninitialized().into_initialized()
|
||||
mem::MaybeUninit::<Foo>::uninit().assume_init()
|
||||
}).err().and_then(|a| a.downcast_ref::<String>().map(|s| {
|
||||
s == "Attempted to instantiate uninhabited type Foo"
|
||||
})),
|
||||
@ -90,7 +90,7 @@ fn main() {
|
||||
|
||||
assert_eq!(
|
||||
panic::catch_unwind(|| {
|
||||
mem::MaybeUninit::<Bar>::uninitialized().into_initialized()
|
||||
mem::MaybeUninit::<Bar>::uninit().assume_init()
|
||||
}).err().and_then(|a| a.downcast_ref::<String>().map(|s| {
|
||||
s == "Attempted to instantiate uninhabited type Bar"
|
||||
})),
|
||||
|
Loading…
x
Reference in New Issue
Block a user