From ce9ca45c92b9bd4b449f94339fbe60a4ded9ab28 Mon Sep 17 00:00:00 2001 From: Aaron Taner Date: Tue, 18 May 2021 00:28:17 +0800 Subject: [PATCH] doc: fix invalid `#[doc(inline)]` warnings on latest nightly. (#3788) This commit fixed issue #3787 by removing [doc(inline)] from macro `cfg_macros` and added proper #[doc(inline)] attributes to `pub use` items inside `cfg_macros` calls. It's probably not `cfg_macros`s responsibility to inlining public macros, though it's conveninent to do so. Notice that in lib.rs: cfg_macros! { /// Implementation detail of the `select!` macro. This macro is **not** /// intended to be used as part of the public API and is permitted to /// change. #[doc(hidden)] pub use tokio_macros::select_priv_declare_output_enum; ... } `#[doc(hidden)]` and `#[doc(inline)]` are conflict with each other in the sense of correctness. Fixes: #3787 --- tokio-util/src/time/mod.rs | 2 +- tokio/src/lib.rs | 8 ++++++++ tokio/src/macros/cfg.rs | 1 - 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tokio-util/src/time/mod.rs b/tokio-util/src/time/mod.rs index c6c8799d9..2d3400836 100644 --- a/tokio-util/src/time/mod.rs +++ b/tokio-util/src/time/mod.rs @@ -12,9 +12,9 @@ use std::time::Duration; mod wheel; -#[doc(inline)] pub mod delay_queue; +#[doc(inline)] pub use delay_queue::DelayQueue; // ===== Internal utils ===== diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index 15aeced6d..d2d4563d2 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -453,15 +453,20 @@ cfg_macros! { #[cfg(feature = "rt-multi-thread")] #[cfg(not(test))] // Work around for rust-lang/rust#62127 #[cfg_attr(docsrs, doc(cfg(feature = "macros")))] + #[doc(inline)] pub use tokio_macros::main; #[cfg(feature = "rt-multi-thread")] #[cfg_attr(docsrs, doc(cfg(feature = "macros")))] + #[doc(inline)] pub use tokio_macros::test; cfg_not_rt_multi_thread! { #[cfg(not(test))] // Work around for rust-lang/rust#62127 + #[doc(inline)] pub use tokio_macros::main_rt as main; + + #[doc(inline)] pub use tokio_macros::test_rt as test; } } @@ -469,7 +474,10 @@ cfg_macros! { // Always fail if rt is not enabled. cfg_not_rt! { #[cfg(not(test))] + #[doc(inline)] pub use tokio_macros::main_fail as main; + + #[doc(inline)] pub use tokio_macros::test_fail as test; } } diff --git a/tokio/src/macros/cfg.rs b/tokio/src/macros/cfg.rs index 344261293..02517ccef 100644 --- a/tokio/src/macros/cfg.rs +++ b/tokio/src/macros/cfg.rs @@ -157,7 +157,6 @@ macro_rules! cfg_macros { $( #[cfg(feature = "macros")] #[cfg_attr(docsrs, doc(cfg(feature = "macros")))] - #[doc(inline)] $item )* }