Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing Send bound #3089

Merged
merged 2 commits into from Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions tokio/Cargo.toml
Expand Up @@ -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 }
Expand Down Expand Up @@ -134,4 +134,4 @@ all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.playground]
features = ["full"]
features = ["full"]
2 changes: 2 additions & 0 deletions tokio/src/runtime/blocking/pool.rs
Expand Up @@ -70,6 +70,7 @@ const KEEP_ALIVE: Duration = Duration::from_secs(10);
pub(crate) fn spawn_blocking<F, R>(func: F) -> JoinHandle<R>
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)
Expand All @@ -79,6 +80,7 @@ where
pub(crate) fn try_spawn_blocking<F, R>(func: F) -> Result<(), ()>
where
F: FnOnce() -> R + Send + 'static,
R: Send + 'static,
{
let rt = context::current().expect("not currently running on the Tokio runtime.");

Expand Down
3 changes: 2 additions & 1 deletion tokio/src/runtime/blocking/task.rs
Expand Up @@ -19,7 +19,8 @@ impl<T> Unpin for BlockingTask<T> {}

impl<T, R> Future for BlockingTask<T>
where
T: FnOnce() -> R,
T: FnOnce() -> R + Send + 'static,
R: Send + 'static,
{
type Output = R;

Expand Down
1 change: 1 addition & 0 deletions tokio/src/runtime/handle.rs
Expand Up @@ -45,6 +45,7 @@ impl Handle {
pub(crate) fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R>
where
F: FnOnce() -> R + Send + 'static,
R: Send + 'static,
{
#[cfg(feature = "tracing")]
let func = {
Expand Down
1 change: 1 addition & 0 deletions tokio/src/runtime/mod.rs
Expand Up @@ -392,6 +392,7 @@ cfg_rt! {
pub fn spawn_blocking<F, R>(&self, func: F) -> JoinHandle<R>
where
F: FnOnce() -> R + Send + 'static,
R: Send + 'static,
{
self.handle.spawn_blocking(func)
}
Expand Down