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

Unable to use the docsrs configuration under Windows #6625

Open
Coding-Badly opened this issue Jun 9, 2024 · 1 comment
Open

Unable to use the docsrs configuration under Windows #6625

Coding-Badly opened this issue Jun 9, 2024 · 1 comment
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug. T-docs Topic: documentation

Comments

@Coding-Badly
Copy link

Version
1.38.0

Platform
Windows 11 Pro / 64 bit

Description
On Windows, the documentation for a project using Tokio cannot be build with docsrs enabled. This makes it difficult-to-impossible to include the automatically generated feature flag details. More details are available from this post on the Rust Users forum.

A test project was created with cargo new tokio-issue-112683.

Cargo.toml was updated to this...

[package]
name = "tokio-issue-112683"
version = "0.1.0"
edition = "2021"

[dependencies]
tokio = { version = "1.38.0", features = ["full"] }

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

Set the RUSTFLAGS environment variable...
set RUSTFLAGS=--cfg docsrs

Then try to build the documentation...
cargo +nightly doc --all-features

The error list is long...

    Checking tokio v1.38.0
error[E0433]: failed to resolve: could not find `unix` in `os`
  --> C:\Users\bcook\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.38.0\src\io\bsd\poll_aio.rs:12:14
   |
12 | use std::os::unix::io::AsRawFd;
   |              ^^^^ could not find `unix` in `os`
   |
note: found an item that was configured out
  --> C:\Users\bcook\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\std\src\os\mod.rs:26:9
   |
26 | pub mod unix {}
   |         ^^^^
note: found an item that was configured out
  --> C:\Users\bcook\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\std\src\os\mod.rs:64:9
   |
64 | pub mod unix;
   |         ^^^^

error[E0433]: failed to resolve: could not find `unix` in `os`
  --> C:\Users\bcook\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.38.0\src\io\bsd\poll_aio.rs:13:14
   |
13 | use std::os::unix::prelude::RawFd;
   |              ^^^^ could not find `unix` in `os`
   |
note: found an item that was configured out
  --> C:\Users\bcook\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\std\src\os\mod.rs:26:9
   |
26 | pub mod unix {}
   |         ^^^^
note: found an item that was configured out
  --> C:\Users\bcook\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\std\src\os\mod.rs:64:9
   |
64 | pub mod unix;
   |         ^^^^

...
@Coding-Badly Coding-Badly added A-tokio Area: The main tokio crate C-bug Category: This is a bug. labels Jun 9, 2024
@Darksonn Darksonn added the T-docs Topic: documentation label Jun 10, 2024
@Darksonn
Copy link
Contributor

I think that we should probably only support building docs that include items from all platforms on unix. But trying to build docs on windows should still successfully build docs for the things that are available on windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug. T-docs Topic: documentation
Projects
None yet
Development

No branches or pull requests

2 participants