From e41e6cddbba0cf13403924937ffe02aae6639e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20H=C3=BCbsch?= Date: Sat, 19 Dec 2020 19:12:08 +0100 Subject: [PATCH] docs: tokio::main macro is also supported on rt (#3243) Fixes: #3144 Refs: #2225 --- tokio-macros/src/lib.rs | 2 ++ tokio/src/lib.rs | 17 +++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/tokio-macros/src/lib.rs b/tokio-macros/src/lib.rs index df847dec5..120d35ad4 100644 --- a/tokio-macros/src/lib.rs +++ b/tokio-macros/src/lib.rs @@ -53,6 +53,8 @@ use proc_macro::TokenStream; /// The `worker_threads` option configures the number of worker threads, and /// defaults to the number of cpus on the system. This is the default flavor. /// +/// Note: The multi-threaded runtime requires the `rt-multi-thread` feature flag. +/// /// # Current thread runtime /// /// To use the single-threaded runtime known as the `current_thread` runtime, diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index c65fa64f1..70ec0b4a2 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -453,17 +453,14 @@ cfg_macros! { pub use tokio_macros::select_priv_declare_output_enum; cfg_rt! { - cfg_rt_multi_thread! { - // This is the docs.rs case (with all features) so make sure macros - // is included in doc(cfg). + #[cfg(feature = "rt-multi-thread")] + #[cfg(not(test))] // Work around for rust-lang/rust#62127 + #[cfg_attr(docsrs, doc(cfg(feature = "macros")))] + pub use tokio_macros::main; - #[cfg(not(test))] // Work around for rust-lang/rust#62127 - #[cfg_attr(docsrs, doc(cfg(feature = "macros")))] - pub use tokio_macros::main; - - #[cfg_attr(docsrs, doc(cfg(feature = "macros")))] - pub use tokio_macros::test; - } + #[cfg(feature = "rt-multi-thread")] + #[cfg_attr(docsrs, doc(cfg(feature = "macros")))] + pub use tokio_macros::test; cfg_not_rt_multi_thread! { #[cfg(not(test))] // Work around for rust-lang/rust#62127