diff --git a/tokio/src/signal/mod.rs b/tokio/src/signal/mod.rs index cca3963e113..6d2e0fff331 100644 --- a/tokio/src/signal/mod.rs +++ b/tokio/src/signal/mod.rs @@ -61,6 +61,9 @@ mod os { } pub mod unix; + +#[cfg(any(windows, docsrs))] +#[cfg_attr(docsrs, doc(cfg(windows)))] pub mod windows; mod reusable_box; diff --git a/tokio/src/signal/windows.rs b/tokio/src/signal/windows.rs index 43dab808bba..2ed347c0387 100644 --- a/tokio/src/signal/windows.rs +++ b/tokio/src/signal/windows.rs @@ -12,18 +12,11 @@ use crate::signal::RxFuture; use std::io; use std::task::{Context, Poll}; -#[cfg(windows)] #[path = "windows/sys.rs"] mod imp; -#[cfg(windows)] pub(crate) use self::imp::{OsExtraData, OsStorage}; -// For building documentation on Unix machines when the `docsrs` flag is set. -#[cfg(not(windows))] -#[path = "windows/stub.rs"] -mod imp; - /// Creates a new listener which receives "ctrl-c" notifications sent to the /// process. /// diff --git a/tokio/src/signal/windows/stub.rs b/tokio/src/signal/windows/stub.rs index 61df30979b6..be009073abc 100644 --- a/tokio/src/signal/windows/stub.rs +++ b/tokio/src/signal/windows/stub.rs @@ -1,3 +1,6 @@ +#![cfg(any(windows, docsrs))] +#![cfg_attr(docsrs, doc(cfg(all(windows, feature = "signal"))))] + //! Stub implementations for the platform API so that rustdoc can build linkable //! documentation on non-windows platforms. diff --git a/tokio/src/signal/windows/sys.rs b/tokio/src/signal/windows/sys.rs index 26e6bdf8182..e3bd57f3a2c 100644 --- a/tokio/src/signal/windows/sys.rs +++ b/tokio/src/signal/windows/sys.rs @@ -1,3 +1,6 @@ +#![cfg(any(windows, docsrs))] +#![cfg_attr(docsrs, doc(cfg(all(windows, feature = "signal"))))] + use std::io; use std::sync::Once;