We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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 rustdoc
Steps
Setup:
> cargo new foo && cd foo Created binary (application) `foo` package > cargo add --dev serde Updating 'https://github.com/rust-lang/crates.io-index' index Adding serde v1.0.123 to dev-dependencies > mkdir examples > echo 'use serde; fn main() {}' > examples/bar.rs > mkdir benches > echo 'use serde; fn main() {}' > benches/bar.rs
Building works:
> cargo build --bench bar --example bar Compiling serde v1.0.123 Compiling foo v0.1.0 (/tmp/tmp.zlGcSI2CHo/foo) warning: unused import: `serde` --> examples/bar.rs:1:5 | 1 | use serde; fn main() {} | ^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused import: `serde` --> benches/bar.rs:1:5 | 1 | use serde; fn main() {} | ^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: 1 warning emitted warning: 1 warning emitted Finished dev [unoptimized + debuginfo] target(s) in 4.60s
Documenting fails:
> cargo rustdoc --example bar Documenting foo v0.1.0 (/tmp/tmp.zlGcSI2CHo/foo) error[E0432]: unresolved import `serde` --> examples/bar.rs:1:5 | 1 | use serde; fn main() {} | ^^^^^ no external crate `serde` error: Compilation failed, aborting rustdoc error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0432`. error: could not document `foo` Caused by: process didn't exit successfully: `rustdoc --edition=2018 --crate-type bin --crate-name bar examples/bar.rs -o /tmp/tmp.zlGcSI2CHo/foo/target/doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=/tmp/tmp.zlGcSI2CHo/foo/target/debug/deps --crate-version 0.1.0` (exit code: 1) > cargo rustdoc --bench bar Documenting foo v0.1.0 (/tmp/tmp.zlGcSI2CHo/foo) error[E0432]: unresolved import `serde` --> benches/bar.rs:1:5 | 1 | use serde; fn main() {} | ^^^^^ no external crate `serde` error: Compilation failed, aborting rustdoc error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0432`. error: could not document `foo` Caused by: process didn't exit successfully: `rustdoc --edition=2018 --crate-type bin --crate-name bar benches/bar.rs -o /tmp/tmp.zlGcSI2CHo/foo/target/doc --error-format=json --json=diagnostic-rendered-ansi -L dependency=/tmp/tmp.zlGcSI2CHo/foo/target/debug/deps --crate-version 0.1.0` (exit code: 1)
Notes
Output of cargo version: cargo 1.50.0-nightly (63d0fe4 2020-12-02)
cargo version
The text was updated successfully, but these errors were encountered:
This seems to be fixed by including dev-dependencies when generating UnitDeps. willcrichton@b973cce
UnitDep
Sorry, something went wrong.
Fix for issue rust-lang#9198
4ac6835
This issue affects the new cargo doc --examples too.
cargo doc --examples
be4bb61
cargo doc --example
Successfully merging a pull request may close this issue.
Steps
Setup:
Building works:
Documenting fails:
Notes
Output of
cargo version
: cargo 1.50.0-nightly (63d0fe4 2020-12-02)The text was updated successfully, but these errors were encountered: