Description
Problem
I tried this code: cargo doc && RUSTDOCFLAGS='-Z unstable-options '--show-coverage cargo doc
I expected to see this happen: There is documentation in target/doc/crate_name
Instead, this happened: The docs get deleted.
searched nightlies: from nightly-2021-04-28 to nightly-2021-04-29
regressed nightly: nightly-2021-04-29
searched commits: from rust-lang/rust@727d101 to rust-lang/rust@ca075d2
regressed commit: rust-lang/rust@27bd3f5
bisected with cargo-bisect-rustc v0.6.0
Host triple: x86_64-unknown-linux-gnu
Reproduce with:
cargo bisect-rustc --script ./docs-exist.sh --preserve --start 2021-04-28 --end 2021-04-29
Looks like this is related to the recent rustdoc changes (#9419 or #9404).
Steps
cargo doc
RUSTDOCFLAGS=--show-coverage cargo doc
[ -e ${CARGO_TARGET_DIR:-target}/doc/crate_name ]
Possible Solution(s)
Only delete the docs folder if the sources or toolchain changes, not the invocation.
Notes
For context, this causes problems for docs.rs because we always run coverage after the docs are generated. We can work around it for now by running coverage before instead, but it would be nice to fix this. In the meantime I've pinned docs.rs to an older toolchain.