From e4ceb3f15a8e57d0de7415c6acdc13868f72dc7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Mon, 19 Feb 2024 11:01:44 +0100 Subject: [PATCH] fix(executor): replace `Pin::new_unchecked` with `pin!` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Kröning --- src/executor/mod.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/executor/mod.rs b/src/executor/mod.rs index 5025965b63..088c5d70df 100644 --- a/src/executor/mod.rs +++ b/src/executor/mod.rs @@ -9,6 +9,7 @@ pub(crate) mod task; use alloc::sync::Arc; use alloc::task::Wake; use core::future::Future; +use core::pin::pin; use core::sync::atomic::AtomicU32; use core::task::{Context, Poll, Waker}; use core::time::Duration; @@ -127,8 +128,7 @@ where let start = now(); let waker = core::task::Waker::noop(); let mut cx = Context::from_waker(&waker); - let mut future = future; - let mut future = unsafe { core::pin::Pin::new_unchecked(&mut future) }; + let mut future = pin!(future); loop { // run background tasks @@ -197,8 +197,7 @@ where let task_notify = Arc::new(TaskNotify::new()); let waker = task_notify.clone().into(); let mut cx = Context::from_waker(&waker); - let mut future = future; - let mut future = unsafe { core::pin::Pin::new_unchecked(&mut future) }; + let mut future = pin!(future); loop { // run background tasks