Rust 1.60 coverage + doctest = crate dependency snafu?

I have a (currently) closed-source crate. I'm trying to use the new coverage tools built into Rust 1.60 stable and I'm seeing some weird behavior when trying to run unit tests with coverage enabled.

When I run:

RUSTFLAGS="-C instrument-coverage" cargo test --all-features

I get hundreds of errors of the flavor …

error[E0463]: can't find crate for `serde_derive` which `ciborium` depends on
 --> (path redacted)
  |
4 | use ciborium::value::Value;
  |     ^^^^^^^^ can't find crate

… when it gets to the doctest portion of the test suite. (Ironically, this crate currently has no doc tests.)

If I add …

[lib]
doctest = false

… to Cargo.toml or compile without the instrument-coverage flag, I have no such errors.

Rust 1.60 stable, macOS 12.1 (Intel), closed-source (currently) crate.

Before I start digging in deeper, I would like to know if:

(a) Anyone else is seeing anything like this?
(b) Would it help the Rust core team if I could find a publicly-visible repro case?

1 Like

Also occurs with 1.62.0-nightly (8f36334ca 2022-04-06).

If you could publish a ticket with a repro case, it would be very useful. I guess it isn't technically a regression, but it is a bug to be resolved.

Ticket here: Compiling with `RUSTFLAGS="-C instrument-coverage"` changes dependency tracking for doctest builds · Issue #95825 · rust-lang/rust · GitHub with repro case linked in the ticket.

100% reproducible for me with that repo.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.