Skip to content

cargo test --doc can't find crate in dev-dependencies #3422

@fengcen

Description

@fengcen

It works when the crate is in the [dependencies] section.

Rust version: 1.15.0-nightly (8f02c429a 2016-12-15)
Cargo version: 0.16.0-nightly (ddb5c32 2016-12-16)
Platform: Windows

Output:

running 1 test
test _0 ... FAILED

failures:

---- _0 stdout ----
        error[E0463]: can't find crate for `num_cpus`
 --> <anon>:2:1
  |
2 | extern crate num_cpus;
  | ^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

thread '_0' panicked at 'Box<Any>', C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\librustc_errors\lib.rs:460
note: Run with `RUST_BACKTRACE=1` for a backtrace.
thread '_0' panicked at 'couldn't compile the test', C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\librustdoc\test.rs:261


failures:
    _0

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured

Doc:

//! # Examples
//!
//! ```
//! extern crate num_cpus;
//!
//! fn main() {
//!     ...
//! }
//! ```

Cargo.toml:

[dev-dependencies]
num_cpus = "^1.2"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions