Skip to content

Commit 92ccade

Browse files
authored
runtime: fix stability feature flags for docs (#6909)
1 parent fbfeb9a commit 92ccade

File tree

6 files changed

+27
-4
lines changed

6 files changed

+27
-4
lines changed

tokio/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,10 @@
351351
//! - [`task::Builder`]
352352
//! - Some methods on [`task::JoinSet`]
353353
//! - [`runtime::RuntimeMetrics`]
354+
//! - [`runtime::Builder::on_task_spawn`]
355+
//! - [`runtime::Builder::on_task_terminate`]
354356
//! - [`runtime::Builder::unhandled_panic`]
355-
//! - [`task::Id`]
357+
//! - [`runtime::TaskMeta`]
356358
//!
357359
//! This flag enables **unstable** features. The public API of these features
358360
//! may break in 1.x releases. To enable these features, the `--cfg

tokio/src/runtime/builder.rs

+14
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,12 @@ impl Builder {
706706
///
707707
/// This *does not* support [`LocalSet`](crate::task::LocalSet) at this time.
708708
///
709+
/// **Note**: This is an [unstable API][unstable]. The public API of this type
710+
/// may break in 1.x releases. See [the documentation on unstable
711+
/// features][unstable] for details.
712+
///
713+
/// [unstable]: crate#unstable-features
714+
///
709715
/// # Examples
710716
///
711717
/// ```
@@ -728,6 +734,7 @@ impl Builder {
728734
/// # }
729735
/// ```
730736
#[cfg(all(not(loom), tokio_unstable))]
737+
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))]
731738
pub fn on_task_spawn<F>(&mut self, f: F) -> &mut Self
732739
where
733740
F: Fn(&TaskMeta<'_>) + Send + Sync + 'static,
@@ -748,6 +755,12 @@ impl Builder {
748755
///
749756
/// This *does not* support [`LocalSet`](crate::task::LocalSet) at this time.
750757
///
758+
/// **Note**: This is an [unstable API][unstable]. The public API of this type
759+
/// may break in 1.x releases. See [the documentation on unstable
760+
/// features][unstable] for details.
761+
///
762+
/// [unstable]: crate#unstable-features
763+
///
751764
/// # Examples
752765
///
753766
/// ```
@@ -770,6 +783,7 @@ impl Builder {
770783
/// # }
771784
/// ```
772785
#[cfg(all(not(loom), tokio_unstable))]
786+
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))]
773787
pub fn on_task_terminate<F>(&mut self, f: F) -> &mut Self
774788
where
775789
F: Fn(&TaskMeta<'_>) + Send + Sync + 'static,

tokio/src/runtime/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,9 @@ cfg_rt! {
384384

385385
mod task_hooks;
386386
pub(crate) use task_hooks::{TaskHooks, TaskCallback};
387-
#[cfg(tokio_unstable)]
388-
pub use task_hooks::TaskMeta;
387+
cfg_unstable! {
388+
pub use task_hooks::TaskMeta;
389+
}
389390
#[cfg(not(tokio_unstable))]
390391
pub(crate) use task_hooks::TaskMeta;
391392

tokio/src/runtime/runtime.rs

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ pub enum RuntimeFlavor {
119119
MultiThread,
120120
/// The flavor that executes tasks across multiple threads.
121121
#[cfg(tokio_unstable)]
122+
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))]
122123
MultiThreadAlt,
123124
}
124125

tokio/src/runtime/task/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,6 @@ impl<S: 'static> Task<S> {
391391
///
392392
/// [task ID]: crate::task::Id
393393
#[cfg(tokio_unstable)]
394-
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))]
395394
pub(crate) fn id(&self) -> crate::task::Id {
396395
// Safety: The header pointer is valid.
397396
unsafe { Header::get_id(self.raw.header_ptr()) }

tokio/src/runtime/task_hooks.rs

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ pub(crate) struct TaskHooks {
1515
}
1616

1717
/// Task metadata supplied to user-provided hooks for task events.
18+
///
19+
/// **Note**: This is an [unstable API][unstable]. The public API of this type
20+
/// may break in 1.x releases. See [the documentation on unstable
21+
/// features][unstable] for details.
22+
///
23+
/// [unstable]: crate#unstable-features
1824
#[allow(missing_debug_implementations)]
1925
#[cfg_attr(not(tokio_unstable), allow(unreachable_pub))]
2026
pub struct TaskMeta<'a> {

0 commit comments

Comments
 (0)