Skip to content

Commit

Permalink
Fixing docs build with -C docsrs on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jofas committed Nov 4, 2024
1 parent 39d552c commit ca636e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
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

0 comments on commit ca636e4

Please sign in to comment.