diff --git a/tokio/src/runtime/handle.rs b/tokio/src/runtime/handle.rs index c5f2b6715..2024cffd3 100644 --- a/tokio/src/runtime/handle.rs +++ b/tokio/src/runtime/handle.rs @@ -70,7 +70,8 @@ impl Handle { #[cfg(feature = "rt-core")] pub fn spawn(&self, future: F) -> JoinHandle where - F: Future + Send + 'static, + F: Future + Send + 'static, + F::Output: Send + 'static, { match &self.kind { Kind::Shell => panic!("spawning not enabled for runtime"), diff --git a/tokio/src/runtime/mod.rs b/tokio/src/runtime/mod.rs index 686a5c262..2d5952420 100644 --- a/tokio/src/runtime/mod.rs +++ b/tokio/src/runtime/mod.rs @@ -299,7 +299,8 @@ impl Runtime { #[cfg(feature = "rt-core")] pub fn spawn(&self, future: F) -> JoinHandle where - F: Future + Send + 'static, + F: Future + Send + 'static, + F::Output: Send + 'static, { match &self.kind { Kind::Shell(_) => panic!("task execution disabled"),