diff --git a/crates/bevy_tasks/src/lib.rs b/crates/bevy_tasks/src/lib.rs index 16ff97bd74..7b1438d4b2 100644 --- a/crates/bevy_tasks/src/lib.rs +++ b/crates/bevy_tasks/src/lib.rs @@ -16,6 +16,9 @@ extern crate std; extern crate alloc; +#[cfg(not(any(feature = "async_executor", feature = "edge_executor")))] +compile_error!("Either of the `async_executor` or the `edge_executor` features must be enabled."); + #[cfg(not(target_arch = "wasm32"))] mod conditional_send { /// Use [`ConditionalSend`] to mark an optional Send trait bound. Useful as on certain platforms (eg. Wasm), @@ -45,6 +48,7 @@ pub type BoxedFuture<'a, T> = core::pin::Pin(PhantomData); + + impl<'a> LocalExecutor<'a> { + /// Dummy implementation + pub const fn new() -> Self { + Self(PhantomData) + } + + /// Dummy implementation + pub fn try_tick(&self) -> bool { + unimplemented!() + } + + /// Dummy implementation + pub fn spawn(&self, _: impl Future + 'a) -> Task { + unimplemented!() + } + } +} + +#[cfg(not(any(feature = "async_executor", feature = "edge_executor")))] +use dummy_executor::LocalExecutor; + #[cfg(feature = "std")] thread_local! { static LOCAL_EXECUTOR: LocalExecutor<'static> = const { LocalExecutor::new() };