Make Executor non-Send to close run() safety hole.

This commit is contained in:
Dario Nieuwenhuis 2020-10-31 22:36:45 +01:00
parent 9dea5035b9
commit 76196c424a

View File

@ -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,
}
}