10

The cargo command line tool allows me to generate documentation for my crate, but I have structures like:

#[cfg(target-platform("windows")]
mod winstuff {
     /// Explanation of Windows-specific tasks
}

#[cfg(target-platfrom("linux")]
mod linstuff {
    /// Explanation of Linux-specific tasks
}

When I run cargo docs --no-deps, only the platform-specific module I'm generating documentation for gets generated. How can I generate documentation for all platforms?

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
Valarauca
  • 1,041
  • 3
  • 10
  • 23
  • I don't think there's an easy solution to this; the official Rust documentation [doesn't even have the `std::os::windows` module documented](https://github.com/rust-lang/rust/issues/24658) because of this very issue. The thread on GitHub hints at `docs.rs` having a solution, but I couldn't find the details. – Aurora0001 Nov 18 '16 at 17:28
  • 3
    docs.rs has a platform selector in the upper right hand corner, for every crate's docs. – bluss Nov 18 '16 at 18:13
  • 1
    `doc.rs` is manually generating the docs for each platform using a build script. According to [the cargo issue tracker](https://github.com/rust-lang/rust/issues/1998). There is no fix. – Valarauca Nov 19 '16 at 14:21

1 Answers1

3

This is a known bug, there is no current fix.

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
Valarauca
  • 1,041
  • 3
  • 10
  • 23