mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-21 00:00:10 +02:00
rt: make JoinSet unstable (#4499)
This commit is contained in:
@@ -373,6 +373,16 @@ macro_rules! cfg_trace {
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! cfg_unstable {
|
||||
($($item:item)*) => {
|
||||
$(
|
||||
#[cfg(tokio_unstable)]
|
||||
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))]
|
||||
$item
|
||||
)*
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! cfg_not_trace {
|
||||
($($item:item)*) => {
|
||||
$(
|
||||
|
||||
@@ -135,6 +135,10 @@
|
||||
//! poll call will notice it when the poll finishes, and the task is cancelled
|
||||
//! at that point.
|
||||
|
||||
// Some task infrastructure is here to support `JoinSet`, which is currently
|
||||
// unstable. This should be removed once `JoinSet` is stabilized.
|
||||
#![cfg_attr(not(tokio_unstable), allow(dead_code))]
|
||||
|
||||
mod core;
|
||||
use self::core::Cell;
|
||||
use self::core::Header;
|
||||
|
||||
@@ -300,8 +300,10 @@ cfg_rt! {
|
||||
mod unconstrained;
|
||||
pub use unconstrained::{unconstrained, Unconstrained};
|
||||
|
||||
mod join_set;
|
||||
pub use join_set::JoinSet;
|
||||
cfg_unstable! {
|
||||
mod join_set;
|
||||
pub use join_set::JoinSet;
|
||||
}
|
||||
|
||||
cfg_trace! {
|
||||
mod builder;
|
||||
|
||||
@@ -44,8 +44,10 @@ pub(crate) mod linked_list;
|
||||
mod rand;
|
||||
|
||||
cfg_rt! {
|
||||
mod idle_notified_set;
|
||||
pub(crate) use idle_notified_set::IdleNotifiedSet;
|
||||
cfg_unstable! {
|
||||
mod idle_notified_set;
|
||||
pub(crate) use idle_notified_set::IdleNotifiedSet;
|
||||
}
|
||||
|
||||
mod wake;
|
||||
pub(crate) use wake::WakerRef;
|
||||
|
||||
@@ -434,13 +434,6 @@ async_assert_fn!(tokio::sync::watch::Receiver<YY>::changed(_): Send & Sync & !Un
|
||||
async_assert_fn!(tokio::sync::watch::Sender<NN>::closed(_): !Send & !Sync & !Unpin);
|
||||
async_assert_fn!(tokio::sync::watch::Sender<YN>::closed(_): !Send & !Sync & !Unpin);
|
||||
async_assert_fn!(tokio::sync::watch::Sender<YY>::closed(_): Send & Sync & !Unpin);
|
||||
|
||||
async_assert_fn!(tokio::task::JoinSet<Cell<u32>>::join_one(_): Send & Sync & !Unpin);
|
||||
async_assert_fn!(tokio::task::JoinSet<Cell<u32>>::shutdown(_): Send & Sync & !Unpin);
|
||||
async_assert_fn!(tokio::task::JoinSet<Rc<u32>>::join_one(_): !Send & !Sync & !Unpin);
|
||||
async_assert_fn!(tokio::task::JoinSet<Rc<u32>>::shutdown(_): !Send & !Sync & !Unpin);
|
||||
async_assert_fn!(tokio::task::JoinSet<u32>::join_one(_): Send & Sync & !Unpin);
|
||||
async_assert_fn!(tokio::task::JoinSet<u32>::shutdown(_): Send & Sync & !Unpin);
|
||||
async_assert_fn!(tokio::task::LocalKey<Cell<u32>>::scope(_, Cell<u32>, BoxFuture<()>): !Send & !Sync & !Unpin);
|
||||
async_assert_fn!(tokio::task::LocalKey<Cell<u32>>::scope(_, Cell<u32>, BoxFutureSend<()>): Send & !Sync & !Unpin);
|
||||
async_assert_fn!(tokio::task::LocalKey<Cell<u32>>::scope(_, Cell<u32>, BoxFutureSync<()>): Send & !Sync & !Unpin);
|
||||
@@ -458,10 +451,20 @@ assert_value!(tokio::task::JoinError: Send & Sync & Unpin);
|
||||
assert_value!(tokio::task::JoinHandle<NN>: !Send & !Sync & Unpin);
|
||||
assert_value!(tokio::task::JoinHandle<YN>: Send & Sync & Unpin);
|
||||
assert_value!(tokio::task::JoinHandle<YY>: Send & Sync & Unpin);
|
||||
assert_value!(tokio::task::JoinSet<YY>: Send & Sync & Unpin);
|
||||
assert_value!(tokio::task::JoinSet<YN>: Send & Sync & Unpin);
|
||||
assert_value!(tokio::task::JoinSet<NN>: !Send & !Sync & Unpin);
|
||||
assert_value!(tokio::task::LocalSet: !Send & !Sync & Unpin);
|
||||
#[cfg(tokio_unstable)]
|
||||
mod unstable {
|
||||
use super::*;
|
||||
async_assert_fn!(tokio::task::JoinSet<Cell<u32>>::join_one(_): Send & Sync & !Unpin);
|
||||
async_assert_fn!(tokio::task::JoinSet<Cell<u32>>::shutdown(_): Send & Sync & !Unpin);
|
||||
async_assert_fn!(tokio::task::JoinSet<Rc<u32>>::join_one(_): !Send & !Sync & !Unpin);
|
||||
async_assert_fn!(tokio::task::JoinSet<Rc<u32>>::shutdown(_): !Send & !Sync & !Unpin);
|
||||
async_assert_fn!(tokio::task::JoinSet<u32>::join_one(_): Send & Sync & !Unpin);
|
||||
async_assert_fn!(tokio::task::JoinSet<u32>::shutdown(_): Send & Sync & !Unpin);
|
||||
assert_value!(tokio::task::JoinSet<YY>: Send & Sync & Unpin);
|
||||
assert_value!(tokio::task::JoinSet<YN>: Send & Sync & Unpin);
|
||||
assert_value!(tokio::task::JoinSet<NN>: !Send & !Sync & Unpin);
|
||||
assert_value!(tokio::task::LocalSet: !Send & !Sync & Unpin);
|
||||
}
|
||||
|
||||
assert_value!(tokio::runtime::Builder: Send & Sync & Unpin);
|
||||
assert_value!(tokio::runtime::EnterGuard<'_>: Send & Sync & Unpin);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![cfg(feature = "full")]
|
||||
#![cfg(all(feature = "full", tokio_unstable))]
|
||||
|
||||
use tokio::sync::oneshot;
|
||||
use tokio::task::JoinSet;
|
||||
|
||||
Reference in New Issue
Block a user