summaryrefslogtreecommitdiffstats
path: root/tokio/src/task
diff options
context:
space:
mode:
authorAlice Ryhl <alice@ryhl.io>2020-04-12 23:55:37 +0200
committerGitHub <noreply@github.com>2020-04-12 14:55:37 -0700
commit4fc2adae4fcc76fa8ff1169fed3db6d7c9100c4a (patch)
treecd69f0a7a853655c190e9a4474b66e2604a6ab88 /tokio/src/task
parentf39c15334e74b07a44efaa0f7201262e17e4f062 (diff)
task: make LocalSet non-Send (#2398)
This does not count as a breaking change as it fixes a regression and a soundness bug.
Diffstat (limited to 'tokio/src/task')
-rw-r--r--tokio/src/task/local.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/tokio/src/task/local.rs b/tokio/src/task/local.rs
index 551362a1..fce46707 100644
--- a/tokio/src/task/local.rs
+++ b/tokio/src/task/local.rs
@@ -7,6 +7,7 @@ use std::cell::{Cell, RefCell};
use std::collections::VecDeque;
use std::fmt;
use std::future::Future;
+use std::marker::PhantomData;
use std::pin::Pin;
use std::sync::{Arc, Mutex};
use std::task::Poll;
@@ -114,6 +115,9 @@ cfg_rt_util! {
/// State available from thread-local
context: Context,
+
+ /// This type should not be Send.
+ _not_send: PhantomData<*const ()>,
}
}
@@ -228,6 +232,7 @@ impl LocalSet {
waker: AtomicWaker::new(),
}),
},
+ _not_send: PhantomData,
}
}