Problem
Since Rust 1.95, the timing report produced by cargo test --timings includes entries for building "lib" (doc test) units with duration 0.0 seconds, separate from the "lib" (test) unit which has always existed (and has a non-zero duration).
I'm not sure if there is some real work happening corresponding to the (doc test) units and their duration is just not recorded, or if they're completely made up. But either way, at present these zero-second units clutter the report with misleading and/or unactionable information, especially in larger workspaces.
Example:
Steps
cargo new --lib dummy-doctest-timings
cd dummy-doctest-timings
cargo test --timings
- Open timing report and observe the unit called
dummy-doctest-timings v0.1.0 dummy_doctest_timings "lib" (doc test) with duration 0.0s
Possible Solution(s)
No response
Notes
This worked as expected (i.e., no "(doc test)" unit) up until Rust 1.94.1 and started happening since Rust 1.95.
The minimal reproduction above actually builds a (non-doc) test and has no doc tests to run. The timing report remains the same if I do any of these changes:
- Add a doctest to the example project.
- Set
test = false for the lib target in Cargo.toml (so no unit test binary is built or run by cargo test) -- maybe the time to build the doctests is charged to the "(test)" unit?
- Set
doctest = false (without test = false) in the manifest -- i.e., the "(doc test)" unit still shows up, even though cargo test does not report running any doctests.
Finally, if I set test = false and doctest = false, then cargo test --timing fails with this message:
error: failed to render timing report
Caused by:
no timing data found in log
Version
cargo 1.99.0-nightly (59800466c 2026-07-07)
release: 1.99.0-nightly
commit-hash: 59800466c5c41c444d264b1010b4d57e85a7117f
commit-date: 2026-07-07
host: x86_64-unknown-linux-gnu
libgit2: 1.9.4 (sys:0.21.0 vendored)
libcurl: 8.21.0-DEV (sys:0.4.90+curl-8.21.0 vendored ssl:OpenSSL/3.6.3)
ssl: OpenSSL 3.6.3 9 Jun 2026
os: Ubuntu 24.4.0 (noble) [64-bit]
Problem
Since Rust 1.95, the timing report produced by
cargo test --timingsincludes entries for building"lib" (doc test)units with duration 0.0 seconds, separate from the"lib" (test)unit which has always existed (and has a non-zero duration).I'm not sure if there is some real work happening corresponding to the (doc test) units and their duration is just not recorded, or if they're completely made up. But either way, at present these zero-second units clutter the report with misleading and/or unactionable information, especially in larger workspaces.
Example:
Steps
cargo new --lib dummy-doctest-timingscd dummy-doctest-timingscargo test --timingsdummy-doctest-timings v0.1.0 dummy_doctest_timings "lib" (doc test)with duration 0.0sPossible Solution(s)
No response
Notes
This worked as expected (i.e., no "(doc test)" unit) up until Rust 1.94.1 and started happening since Rust 1.95.
The minimal reproduction above actually builds a (non-doc) test and has no doc tests to run. The timing report remains the same if I do any of these changes:
test = falsefor the lib target in Cargo.toml (so no unit test binary is built or run bycargo test) -- maybe the time to build the doctests is charged to the "(test)" unit?doctest = false(withouttest = false) in the manifest -- i.e., the "(doc test)" unit still shows up, even thoughcargo testdoes not report running any doctests.Finally, if I set
test = falseanddoctest = false, thencargo test --timingfails with this message:Version