Rust · Comparison
Rust branch coverage on stable: cargo-llvm-cov, Tarpaulin, Supercov
Branch and MC/DC coverage on stable Rust: cargo-llvm-cov needs nightly for both, Tarpaulin measures lines, and Supercov measures line, branch and MC/DC on stable.
cargo-llvm-cov vs Tarpaulin vs Supercov
On stable Rust, Supercov measures line, branch and MC/DC coverage with supercov -- cargo test. cargo-llvm-cov measures line coverage on stable, and its branch and MC/DC modes need nightly. Tarpaulin measures lines; its branch option is unimplemented in 0.37.2.
Start with cargo-llvm-cov if you want a Cargo-oriented workflow around LLVM coverage. Tarpaulin is another established way to collect Rust coverage. Supercov is useful when you want to investigate coverage by test, independent condition, and checked property.
MC/DC is not exclusive to Supercov. cargo-llvm-cov exposes it through a nightly option. Toolchain requirements matter when choosing between them.
| Feature | cargo-llvm-cov0.9.1 | Tarpaulin0.37.2 | Supercov2.0.0 |
|---|---|---|---|
| Code quality scoring | Not built in | Not built in | Supported |
| Security review | Not built in | Not built in | Supported |
| Line coverage | Supported | Supported | Supported |
| Branch coverage | Supported | Not built in | Supported |
| MC/DC | Supported | Not built in | Supported |
| Per-test coverage | Not built in | Not built in | Supported |
| Assertion coverage | Not built in | Not built in | Supported |
| Reports | Supported | Supported | Supported |
✓ Supported · × Not built in. Standard coverage workflows in the versions shown; custom plugins are outside this table.
Supercov requires Rust 1.95 and supported Cargo runners. cargo-llvm-cov’s branch and MC/DC flags require nightly. Tarpaulin’s branch option is not implemented.
Per-test coverage means individual tests, not just test files. Supercov needs a supported runner. Assertion coverage is Jev’s judgment, test by test, of whether changing each executed statement would make the test fail; it is not a mutation score or a correctness guarantee. Security review comes from Supercov’s Jev checks; reports means a browsable HTML report from the tool itself.
cargo-llvm-cov: check the toolchain
After installing cargo-llvm-cov and the LLVM tools component for your toolchain, run:
cargo llvm-cov
Its usual line-coverage workflow uses stable Rust. Branch and MC/DC collection require nightly in the version compared here:
cargo +nightly llvm-cov --branch
cargo +nightly llvm-cov --mcdc
The project also supports nextest. Check the versioned README before enabling optional modes, especially doctests or MC/DC. A supported flag does not mean every configuration works on stable Rust.
Tarpaulin: a different collection workflow
With cargo-tarpaulin installed:
cargo tarpaulin
Tarpaulin offers collection-engine and platform options. In version 0.37.2, its branch option is marked unimplemented; it should not receive a branch-coverage check just because the option appears in help. See the Tarpaulin README.
If its line coverage already fits your project, that is a valid reason to keep it. Choose based on the source and test configurations you actually need to measure.
What MC/DC adds to a Rust test
fn can_access(signed_in: bool, expired: bool) -> bool {
if signed_in && !expired {
return true;
}
false
}
#[test]
fn access() {
assert!(can_access(true, false));
assert!(!can_access(false, false));
}
Both return paths run, but session expiry is never exercised. Add assert!(!can_access(true, true)) to show that expiry can independently change the result. This is an illustrative Rust example, not a published cross-tool Rust measurement.
Where Supercov fits
With Supercov installed and its required Rust 1.95 toolchain available:
supercov -- cargo test
supercov runs latest gaps
Keep your tests; use Supercov’s output to investigate the missing cases. It supports Cargo runners including nextest, subject to the Rust compatibility guide.
Its additional assertion workflow links source to properties checked by passing tests through an agent’s review of execution evidence. That is different from proving that a test fails under a code mutation.
Choose cargo-llvm-cov for its compiler-coverage workflow, Tarpaulin when its collector fits your project, or Supercov for an investigation workflow that includes tests and assertions. None of these coverage scores guarantees that the program is correct.