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

Cargo doc may fail no_std builds if a dev-dependency uses std #9690

Closed
ryan-summers opened this issue Jul 15, 2021 · 1 comment
Closed

Cargo doc may fail no_std builds if a dev-dependency uses std #9690

ryan-summers opened this issue Jul 15, 2021 · 1 comment
Labels
C-bug Category: bug

Comments

@ryan-summers
Copy link

ryan-summers commented Jul 15, 2021

Problem
When cargo doc is run on a no_std crate, where a dev-dependency uses std, cargo-doc will fail the build.

Since dev-dependencies are not required for the actual build, this is actually acceptable for cargo build. I would expect cargo doc to not fail the compilation if cargo build is successful.

Steps

  1. Create a crate that is no_std
  2. Utilize a dev-dependency that uses std
  3. Run cargo build, note that build succeeds
  4. Run cargo doc, note that cargo doc fails and indicates no crate found: std

Note: A sample of this issue can be found in the crate here: https://github.com/quartiq/stabilizer/tree/3a3cbce005a41e53ac8fac1dc68d107502b19511/dsp

nd-array uses std in this build. If the nd-array dev-depency is updated to use default-features = false, cargo-doc works just fine.

Possible Solution(s)
It's possible that cargo-doc shouldn't be building documentation for dev-dependencies unless explicitly asked, or it should build the dev-dependencies identically to how cargo-build does it.

Notes

$ cargo version
cargo 1.52.0 (69767412a 2021-04-21)
@ryan-summers
Copy link
Author

Closing. This was actually unintended feature unification between dependencies and dev-dependencies that only came up when running cargo doc. Updating the cargo resolver to version 2 resolved this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

1 participant