-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
Description
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)
lukehsiao