diff --git a/tokio/Cargo.toml b/tokio/Cargo.toml index c4825c20650..b67e46c1de2 100644 --- a/tokio/Cargo.toml +++ b/tokio/Cargo.toml @@ -98,7 +98,7 @@ bytes = { version = "0.6.0", optional = true } futures-core = { version = "0.3.0", optional = true } lazy_static = { version = "1.0.2", optional = true } memchr = { version = "2.2", optional = true } -mio = { version = "0.7.3", optional = true } +mio = { version = "0.7.5", optional = true } num_cpus = { version = "1.8.0", optional = true } parking_lot = { version = "0.11.0", optional = true } # Not in full slab = { version = "0.4.1", optional = true } @@ -134,4 +134,4 @@ all-features = true rustdoc-args = ["--cfg", "docsrs"] [package.metadata.playground] -features = ["full"] \ No newline at end of file +features = ["full"] diff --git a/tokio/src/runtime/blocking/pool.rs b/tokio/src/runtime/blocking/pool.rs index 2967a109ee4..6b9fb1bf0af 100644 --- a/tokio/src/runtime/blocking/pool.rs +++ b/tokio/src/runtime/blocking/pool.rs @@ -70,6 +70,7 @@ const KEEP_ALIVE: Duration = Duration::from_secs(10); pub(crate) fn spawn_blocking(func: F) -> JoinHandle where F: FnOnce() -> R + Send + 'static, + R: Send + 'static, { let rt = context::current().expect("not currently running on the Tokio runtime."); rt.spawn_blocking(func) @@ -79,6 +80,7 @@ where pub(crate) fn try_spawn_blocking(func: F) -> Result<(), ()> where F: FnOnce() -> R + Send + 'static, + R: Send + 'static, { let rt = context::current().expect("not currently running on the Tokio runtime."); diff --git a/tokio/src/runtime/blocking/task.rs b/tokio/src/runtime/blocking/task.rs index a521af4630c..ee2d8d6d608 100644 --- a/tokio/src/runtime/blocking/task.rs +++ b/tokio/src/runtime/blocking/task.rs @@ -19,7 +19,8 @@ impl Unpin for BlockingTask {} impl Future for BlockingTask where - T: FnOnce() -> R, + T: FnOnce() -> R + Send + 'static, + R: Send + 'static, { type Output = R; diff --git a/tokio/src/runtime/handle.rs b/tokio/src/runtime/handle.rs index c9ffd5cd0e4..72b9c065f5a 100644 --- a/tokio/src/runtime/handle.rs +++ b/tokio/src/runtime/handle.rs @@ -45,6 +45,7 @@ impl Handle { pub(crate) fn spawn_blocking(&self, func: F) -> JoinHandle where F: FnOnce() -> R + Send + 'static, + R: Send + 'static, { #[cfg(feature = "tracing")] let func = { diff --git a/tokio/src/runtime/mod.rs b/tokio/src/runtime/mod.rs index c76f5cf6d1c..f85344db58c 100644 --- a/tokio/src/runtime/mod.rs +++ b/tokio/src/runtime/mod.rs @@ -392,6 +392,7 @@ cfg_rt! { pub fn spawn_blocking(&self, func: F) -> JoinHandle where F: FnOnce() -> R + Send + 'static, + R: Send + 'static, { self.handle.spawn_blocking(func) }