Coverage out of the box?


I read measuring-test-coverage-of-rust-programs and became interesting is any reasons to not implement workaround described in article as

cargo test --with-coverage
carog run --with-coverage


Or may be cargo team wait fix of this ?


Just wanted to add that this would be a really, really nice feature to have out of the box (or even just in a single crate install).

In Python, this is really easy to get going with pytest-cov or even just the coverage package directly. Letting a new user write a test and run something as simple as cargo test --with-coverage would make coverage very accessible.

1 Like

I agree, it would be really nice if this were a first-class feature of rustc and cargo.

Relatedly, my blog post was up for one day before being broken by 1.19 :anguished:

[Now it seems impossible to get accurate coverage of unit tests. -Zno-landing-pads was the previous method, but -Z isn’t supported any more. The stable replacement -Cpanic=abort isn’t supported for unit tests.]


From one hand this is bad, but from other hand coverage task may run once per day/half day on nightly compiler, just to measure coverage, I doubt that numbers would be different.

1 Like
closed #5

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.