Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix building docs on Windows #6945

Merged
merged 6 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tokio/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ cfg_io_driver_impl! {
pub(crate) use poll_evented::PollEvented;
}

// The bsd module can't be build on Windows, so we completely ignore it, even
// when building documentation.
#[cfg(unix)]
Comment on lines +234 to +236
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should abstract this into a macro that better describes what we are doing? Something like cfg_ignore_in_windows_docs!?

cfg_aio! {
/// BSD-specific I/O types.
pub mod bsd {
Expand Down
3 changes: 3 additions & 0 deletions tokio/src/net/tcp/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,9 @@ impl fmt::Debug for TcpSocket {
}
}

// These trait implementations can't be build on Windows, so we completely
// ignore them, even when building documentation.
#[cfg(unix)]
cfg_unix! {
impl AsRawFd for TcpSocket {
fn as_raw_fd(&self) -> RawFd {
Expand Down
8 changes: 5 additions & 3 deletions tokio/src/signal/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ use crate::signal::RxFuture;
use std::io;
use std::task::{Context, Poll};

#[cfg(not(docsrs))]
#[cfg(windows)]
#[path = "windows/sys.rs"]
mod imp;
#[cfg(not(docsrs))]

#[cfg(windows)]
pub(crate) use self::imp::{OsExtraData, OsStorage};

#[cfg(docsrs)]
// For building documentation on Unix machines when the `docsrs` flag is set.
#[cfg(not(windows))]
#[path = "windows/stub.rs"]
mod imp;

Expand Down
Loading