SupercovCompare
← All comparisons

Rust · Comparison

Rust coverage: cargo-llvm-cov, Tarpaulin, and Supercov

Compare Rust coverage tools, including cargo-llvm-cov's nightly MC/DC support, Tarpaulin, and Supercov's per-test and assertion coverage.

cargo-llvm-cov vs Tarpaulin vs Supercov

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.

Coverage features
Featurecargo-llvm-cov0.9.1Tarpaulin0.37.2Supercov0.0.47
Line coverageSupportedSupportedSupported
Branch coverageSupportedNot built inSupported
MC/DCSupportedNot built inSupported
Per-test coverageNot built inNot built inSupported
Assertion coverageNot built inNot built inSupported

✓ 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 links source to checked properties through agent review; it is not a mutation score or a correctness guarantee.

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.

Feature sources