How to generate coverage for a library with -C instrument-coverage

The documentation for Rust 1.60's new coverage option describes how to generate a coverage report for a binary, but is lacking an example for how to create coverage for a library that is tested via cargo test.

I started from the example provided in the Rust 1.60 announcement (which worked as described) and attempted to adapt that to a crate, but that didn't work.

The error occurs in this line: Adapt example to use a library. · scouten/rust-coverage-sandbox@065476e · GitHub

Can anybody who is familiar with these tools suggest a different invocation here?

Welp, I found a way through that, but the ergonomics of this part of cargo test are ... not wonderful.

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.