Skip to content

Commit 5ada511

Browse files
authored
task: stabilize task::Id related apis (#6891)
1 parent 161b8c8 commit 5ada511

File tree

6 files changed

+1
-19
lines changed

6 files changed

+1
-19
lines changed

tokio/src/runtime/scheduler/current_thread/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@ impl Handle {
447447
let (handle, notified) = me.shared.owned.bind(future, me.clone(), id);
448448

449449
me.task_hooks.spawn(&TaskMeta {
450-
#[cfg(tokio_unstable)]
451450
id,
452451
_phantom: Default::default(),
453452
});

tokio/src/runtime/scheduler/multi_thread/handle.rs

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ impl Handle {
5656
let (handle, notified) = me.shared.owned.bind(future, me.clone(), id);
5757

5858
me.task_hooks.spawn(&TaskMeta {
59-
#[cfg(tokio_unstable)]
6059
id,
6160
_phantom: Default::default(),
6261
});

tokio/src/runtime/task/error.rs

-7
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,7 @@ impl JoinError {
123123
/// Returns a [task ID] that identifies the task which errored relative to
124124
/// other currently spawned tasks.
125125
///
126-
/// **Note**: This is an [unstable API][unstable]. The public API of this type
127-
/// may break in 1.x releases. See [the documentation on unstable
128-
/// features][unstable] for details.
129-
///
130126
/// [task ID]: crate::task::Id
131-
/// [unstable]: crate#unstable-features
132-
#[cfg(tokio_unstable)]
133-
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))]
134127
pub fn id(&self) -> Id {
135128
self.id
136129
}

tokio/src/runtime/task/harness.rs

-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,6 @@ where
337337
if let Some(f) = self.trailer().hooks.task_terminate_callback.as_ref() {
338338
let _ = panic::catch_unwind(panic::AssertUnwindSafe(|| {
339339
f(&TaskMeta {
340-
#[cfg(tokio_unstable)]
341340
id: self.core().task_id,
342341
_phantom: Default::default(),
343342
})

tokio/src/runtime/task_hooks.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@ pub(crate) struct TaskHooks {
1919
#[cfg_attr(not(tokio_unstable), allow(unreachable_pub))]
2020
pub struct TaskMeta<'a> {
2121
/// The opaque ID of the task.
22-
#[cfg(tokio_unstable)]
2322
pub(crate) id: super::task::Id,
2423
pub(crate) _phantom: PhantomData<&'a ()>,
2524
}
2625

2726
impl<'a> TaskMeta<'a> {
2827
/// Return the opaque ID of the task.
29-
#[cfg(tokio_unstable)]
28+
#[cfg_attr(not(tokio_unstable), allow(unreachable_pub, dead_code))]
3029
pub fn id(&self) -> super::task::Id {
3130
self.id
3231
}

tokio/src/task/join_set.rs

-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use std::task::{Context, Poll};
1010
use std::{fmt, panic};
1111

1212
use crate::runtime::Handle;
13-
#[cfg(tokio_unstable)]
1413
use crate::task::Id;
1514
use crate::task::{unconstrained, AbortHandle, JoinError, JoinHandle, LocalSet};
1615
use crate::util::IdleNotifiedSet;
@@ -300,8 +299,6 @@ impl<T: 'static> JoinSet<T> {
300299
///
301300
/// [task ID]: crate::task::Id
302301
/// [`JoinError::id`]: fn@crate::task::JoinError::id
303-
#[cfg(tokio_unstable)]
304-
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))]
305302
pub async fn join_next_with_id(&mut self) -> Option<Result<(Id, T), JoinError>> {
306303
std::future::poll_fn(|cx| self.poll_join_next_with_id(cx)).await
307304
}
@@ -338,8 +335,6 @@ impl<T: 'static> JoinSet<T> {
338335
///
339336
/// [task ID]: crate::task::Id
340337
/// [`JoinError::id`]: fn@crate::task::JoinError::id
341-
#[cfg(tokio_unstable)]
342-
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))]
343338
pub fn try_join_next_with_id(&mut self) -> Option<Result<(Id, T), JoinError>> {
344339
// Loop over all notified `JoinHandle`s to find one that's ready, or until none are left.
345340
loop {
@@ -544,8 +539,6 @@ impl<T: 'static> JoinSet<T> {
544539
///
545540
/// [coop budget]: crate::task#cooperative-scheduling
546541
/// [task ID]: crate::task::Id
547-
#[cfg(tokio_unstable)]
548-
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))]
549542
pub fn poll_join_next_with_id(
550543
&mut self,
551544
cx: &mut Context<'_>,

0 commit comments

Comments
 (0)