From 1474794055e291c544c3c95d6381d549cefbd7d5 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sat, 16 Nov 2019 15:16:21 +0900 Subject: [PATCH] runtime: allow non-unit type output in {Runtime, Spawner}::spawn (#1756) --- tokio/src/runtime/handle.rs | 3 ++- tokio/src/runtime/mod.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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"),