Move yield_no_wait's flag init out of `unsafe`.
Turns out core::mem::MaybeUninit::uninit is not `unsafe`!
diff --git a/core/platform/src/syscalls_impl.rs b/core/platform/src/syscalls_impl.rs
index c86da40..6671ad2 100644
--- a/core/platform/src/syscalls_impl.rs
+++ b/core/platform/src/syscalls_impl.rs
@@ -13,14 +13,12 @@
// -------------------------------------------------------------------------
fn yield_no_wait() -> YieldNoWaitReturn {
- unsafe {
- // flag can be uninitialized because it is not read before the yield
- // system call, and the kernel promises to only write to it (not
- // read it).
- let mut flag = core::mem::MaybeUninit::<YieldNoWaitReturn>::uninit();
+ let mut flag = core::mem::MaybeUninit::<YieldNoWaitReturn>::uninit();
- // flag is safe to write a YieldNoWaitReturn to, as guaranteed by
- // MaybeUninit.
+ unsafe {
+ // Flag can be uninitialized here because the kernel promises to
+ // only write to it, not read from it. MaybeUninit guarantees that
+ // it is safe to write a YieldNoWaitReturn into it.
Self::yield2(yield_op::NO_WAIT as *mut (), flag.as_mut_ptr() as *mut ());
// yield-no-wait guarantees it sets (initializes) flag before