diff options
Diffstat (limited to 'embassy-executor/src/spawner.rs')
| -rw-r--r-- | embassy-executor/src/spawner.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/embassy-executor/src/spawner.rs b/embassy-executor/src/spawner.rs index 650ea06cb..7c0a0183c 100644 --- a/embassy-executor/src/spawner.rs +++ b/embassy-executor/src/spawner.rs | |||
| @@ -89,10 +89,10 @@ impl Spawner { | |||
| 89 | /// | 89 | /// |
| 90 | /// Panics if the current executor is not an Embassy executor. | 90 | /// Panics if the current executor is not an Embassy executor. |
| 91 | pub async fn for_current_executor() -> Self { | 91 | pub async fn for_current_executor() -> Self { |
| 92 | poll_fn(|cx| unsafe { | 92 | poll_fn(|cx| { |
| 93 | let task = raw::task_from_waker(cx.waker()); | 93 | let task = raw::task_from_waker(cx.waker()); |
| 94 | let executor = task.header().executor.get(); | 94 | let executor = unsafe { task.header().executor.get().unwrap_unchecked() }; |
| 95 | Poll::Ready(Self::new(&*executor)) | 95 | Poll::Ready(Self::new(executor)) |
| 96 | }) | 96 | }) |
| 97 | .await | 97 | .await |
| 98 | } | 98 | } |
| @@ -165,10 +165,10 @@ impl SendSpawner { | |||
| 165 | /// | 165 | /// |
| 166 | /// Panics if the current executor is not an Embassy executor. | 166 | /// Panics if the current executor is not an Embassy executor. |
| 167 | pub async fn for_current_executor() -> Self { | 167 | pub async fn for_current_executor() -> Self { |
| 168 | poll_fn(|cx| unsafe { | 168 | poll_fn(|cx| { |
| 169 | let task = raw::task_from_waker(cx.waker()); | 169 | let task = raw::task_from_waker(cx.waker()); |
| 170 | let executor = task.header().executor.get(); | 170 | let executor = unsafe { task.header().executor.get().unwrap_unchecked() }; |
| 171 | Poll::Ready(Self::new(&*executor)) | 171 | Poll::Ready(Self::new(executor)) |
| 172 | }) | 172 | }) |
| 173 | .await | 173 | .await |
| 174 | } | 174 | } |
