From bce250bbdc18f025547f59c30a7bec24826b3aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Sat, 12 Aug 2023 22:08:46 +0200 Subject: [PATCH] Remove unnecessary !Send markers --- embassy-executor/src/arch/cortex_m.rs | 4 +--- embassy-executor/src/arch/riscv32.rs | 5 +---- embassy-executor/src/arch/std.rs | 6 +----- embassy-executor/src/arch/xtensa.rs | 11 ++--------- 4 files changed, 5 insertions(+), 21 deletions(-) diff --git a/embassy-executor/src/arch/cortex_m.rs b/embassy-executor/src/arch/cortex_m.rs index ca1675c03..355a0f086 100644 --- a/embassy-executor/src/arch/cortex_m.rs +++ b/embassy-executor/src/arch/cortex_m.rs @@ -18,9 +18,7 @@ mod thread { /// TODO // Name pending #[derive(Default)] // Default enables Executor::new - pub struct CortexMThreadContext { - _not_send: core::marker::PhantomData<*mut ()>, - } + pub struct CortexMThreadContext; impl ThreadContext for CortexMThreadContext { #[cfg(feature = "thread-context")] diff --git a/embassy-executor/src/arch/riscv32.rs b/embassy-executor/src/arch/riscv32.rs index 5f766442d..becc0245a 100644 --- a/embassy-executor/src/arch/riscv32.rs +++ b/embassy-executor/src/arch/riscv32.rs @@ -8,7 +8,6 @@ compile_error!("`thread-context` is not supported with `arch-riscv32`."); pub use thread::*; #[cfg(feature = "executor-thread")] mod thread { - use core::marker::PhantomData; use core::sync::atomic::{AtomicBool, Ordering}; #[cfg(feature = "nightly")] @@ -28,9 +27,7 @@ mod thread { /// TODO // Name pending #[derive(Default)] // Default enables Executor::new - pub struct RiscVThreadContext { - _not_send: PhantomData<*mut ()>, - } + pub struct RiscVThreadContext; impl ThreadContext for RiscVThreadContext { fn context(&self) -> OpaqueThreadContext { diff --git a/embassy-executor/src/arch/std.rs b/embassy-executor/src/arch/std.rs index 28e25fbd0..b08974a02 100644 --- a/embassy-executor/src/arch/std.rs +++ b/embassy-executor/src/arch/std.rs @@ -8,7 +8,6 @@ compile_error!("`arch-std` requires `thread-context`."); pub use thread::*; #[cfg(feature = "executor-thread")] mod thread { - use std::marker::PhantomData; use std::sync::{Condvar, Mutex}; #[cfg(feature = "nightly")] @@ -20,16 +19,13 @@ mod thread { /// TODO // Name pending pub struct StdThreadCtx { - _not_send: PhantomData<*mut ()>, signaler: &'static Signaler, } impl Default for StdThreadCtx { fn default() -> Self { - let signaler = &*Box::leak(Box::new(Signaler::new())); Self { - _not_send: PhantomData, - signaler, + signaler: &*Box::leak(Box::new(Signaler::new())), } } } diff --git a/embassy-executor/src/arch/xtensa.rs b/embassy-executor/src/arch/xtensa.rs index 8e1b917de..6357bfef2 100644 --- a/embassy-executor/src/arch/xtensa.rs +++ b/embassy-executor/src/arch/xtensa.rs @@ -27,15 +27,8 @@ mod thread { /// TODO // Name pending - pub struct XtensaThreadContext { - _not_send: PhantomData<*mut ()>, - } - - impl Default for XtensaThreadContext { - fn default() -> Self { - Self { _not_send: PhantomData } - } - } + #[derive(Default)] // Default enables Executor::new + pub struct XtensaThreadContext; impl ThreadContext for XtensaThreadContext { fn context(&self) -> OpaqueThreadContext {