From 76196c424a762ac053c89a9e25652fe975f4d458 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Sat, 31 Oct 2020 22:36:45 +0100 Subject: [PATCH] Make Executor non-Send to close run() safety hole. --- embassy/src/executor/executor.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/embassy/src/executor/executor.rs b/embassy/src/executor/executor.rs index 2f6bfad58..ff3a8517c 100644 --- a/embassy/src/executor/executor.rs +++ b/embassy/src/executor/executor.rs @@ -1,6 +1,7 @@ use core::cell::Cell; use core::cell::UnsafeCell; use core::future::Future; +use core::marker::PhantomData; use core::mem; use core::mem::MaybeUninit; use core::pin::Pin; @@ -241,6 +242,7 @@ impl Drop for SpawnToken { pub struct Executor { queue: Queue, signal_fn: fn(), + not_send: PhantomData<*mut ()>, } impl Executor { @@ -248,6 +250,7 @@ impl Executor { Self { queue: Queue::new(), signal_fn: signal_fn, + not_send: PhantomData, } }