Skip to content

Commit 20a2b9e

Browse files
authored
rt: add missing Send bound (#3089)
1 parent ae4e8d7 commit 20a2b9e

File tree

5 files changed

+8
-3
lines changed

5 files changed

+8
-3
lines changed

tokio/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ bytes = { version = "0.6.0", optional = true }
9898
futures-core = { version = "0.3.0", optional = true }
9999
lazy_static = { version = "1.0.2", optional = true }
100100
memchr = { version = "2.2", optional = true }
101-
mio = { version = "0.7.3", optional = true }
101+
mio = { version = "0.7.5", optional = true }
102102
num_cpus = { version = "1.8.0", optional = true }
103103
parking_lot = { version = "0.11.0", optional = true } # Not in full
104104
slab = { version = "0.4.1", optional = true }
@@ -134,4 +134,4 @@ all-features = true
134134
rustdoc-args = ["--cfg", "docsrs"]
135135

136136
[package.metadata.playground]
137-
features = ["full"]
137+
features = ["full"]

tokio/src/runtime/blocking/pool.rs

+2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ const KEEP_ALIVE: Duration = Duration::from_secs(10);
7070
pub(crate) fn spawn_blocking<F, R>(func: F) -> JoinHandle<R>
7171
where
7272
F: FnOnce() -> R + Send + 'static,
73+
R: Send + 'static,
7374
{
7475
let rt = context::current().expect("not currently running on the Tokio runtime.");
7576
rt.spawn_blocking(func)
@@ -79,6 +80,7 @@ where
7980
pub(crate) fn try_spawn_blocking<F, R>(func: F) -> Result<(), ()>
8081
where
8182
F: FnOnce() -> R + Send + 'static,
83+
R: Send + 'static,
8284
{
8385
let rt = context::current().expect("not currently running on the Tokio runtime.");
8486

tokio/src/runtime/blocking/task.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ impl<T> Unpin for BlockingTask<T> {}
1919

2020
impl<T, R> Future for BlockingTask<T>
2121
where
22-
T: FnOnce() -> R,
22+
T: FnOnce() -> R + Send + 'static,
23+
R: Send + 'static,
2324
{
2425
type Output = R;
2526

tokio/src/runtime/handle.rs

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ impl Handle {
4545
pub(crate) fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R>
4646
where
4747
F: FnOnce() -> R + Send + 'static,
48+
R: Send + 'static,
4849
{
4950
#[cfg(feature = "tracing")]
5051
let func = {

tokio/src/runtime/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ cfg_rt! {
392392
pub fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R>
393393
where
394394
F: FnOnce() -> R + Send + 'static,
395+
R: Send + 'static,
395396
{
396397
self.handle.spawn_blocking(func)
397398
}

0 commit comments

Comments
 (0)