- Home
- Test Coverage Tools
- cargo-llvm-cov
cargo-llvm-cov
What it is
cargo-llvm-cov is a Cargo subcommand that wraps rustc's LLVM source-based instrumentation for code coverage. It works with cargo test, cargo run, and cargo nextest through a Cargo-compatible command-line interface, and supports proc-macro UI tests. It generates line and region coverage; branch coverage is optional and currently requires nightly Rust. Doc-test coverage is also optional, requires nightly features, and has known issues. Reports can be produced as text, HTML, JSON, LCOV, Cobertura XML, or Codecov Custom Coverage format. The README includes GitHub Actions examples for sending reports to Codecov and a GitLab CI example using Cobertura output. LCOV reports can be viewed in VS Code with the Coverage Gutters extension. With compatible Clang and LLVM tools configured, it can cover C and C++ code linked to a Rust library or binary. It supports Linux, macOS, and Windows. Installation requires rustc 1.87 or newer, while running it requires Cargo 1.60 or newer. The project is free and open source under Apache-2.0 or MIT, at the user's choice.
For and against
For
- Works with cargo test, cargo run, and cargo nextest.
- Generates line and region coverage.
- Offers six report formats.
- Includes GitHub Actions and GitLab CI examples.
- Available under Apache-2.0 or MIT.
Against
- Branch coverage requires nightly Rust.
- Doc-test coverage requires nightly features and has known issues.
- Installation requires rustc 1.87 or newer.
The verdict
cargo-llvm-cov provides flexible coverage reports for Cargo workflows, with optional C and C++ coverage when the required tools are configured. Nightly features are needed for branch and doc-test coverage, and installation has a current rustc requirement.
Who it suits
This tool suits Rust developers who want source coverage reports for tests and related workflows. Teams linking C or C++ code to Rust can also include that code when compatible Clang and LLVM tools are configured.
Plans and prices
Free / open source
Apache-2.0 or MIT licensed · no paid plans stated
Read 8 Oct 2026 · github.com
On the record
- CI integrations
- The README provides GitHub Actions examples for uploading reports to Codecov and a GitLab CI example using Cobertura output.github.com · read 8 Oct 2026
- Coverage types
- It generates line and region coverage, while branch coverage is optional and currently requires nightly Rust.github.com · read 8 Oct 2026
- Editor integration
- LCOV output can be displayed in VS Code using the Coverage Gutters extension.github.com · read 8 Oct 2026
- Installation
- It can be installed from source with Cargo, as a prebuilt release binary, through GitHub Actions, Homebrew, Scoop, cargo-binstall, pacman, or FreeBSD ports.github.com · read 8 Oct 2026
- Known limitations
- Branch coverage is unstable, and doc-test coverage is unstable and has known issues.github.com · read 8 Oct 2026
- License
- The project is available under either the Apache License 2.0 or the MIT License, at the user's option.github.com · read 8 Oct 2026
- Other code coverage
- With compatible Clang and LLVM tools configured, it can include coverage for C/C++ code linked to a Rust library or binary.github.com · read 8 Oct 2026
- Platform coverage
- Prebuilt binaries are listed for Linux, macOS, Windows, and FreeBSD; confirmed Windows targets include x86_64 and i686 MSVC and x86_64 and aarch64 GNU/LLVM MinGW.github.com · read 8 Oct 2026
- Purpose
- cargo-llvm-cov is a Cargo subcommand that wraps rustc’s LLVM source-based code coverage instrumentation.github.com · read 8 Oct 2026
- Report formats
- Coverage reports can be generated as text, HTML, JSON, LCOV, Cobertura XML, or Codecov Custom Coverage format.github.com · read 8 Oct 2026
- Requirements
- Installing currently requires rustc 1.87 or newer, while running it requires Cargo 1.60 or newer.github.com · read 8 Oct 2026
- Rust test support
- It supports proc-macro UI tests and doc tests, though doc-test coverage is optional and requires nightly features.github.com · read 8 Oct 2026
- Security and releases
- The README says releases are immutable and releases since 0.8.5 publish artifact attestations, with commands documented for verifying release and artifact attestations.github.com · read 8 Oct 2026
- Test runners
- It supports cargo test, cargo run, and cargo nextest through a Cargo-compatible command-line interface.github.com · read 8 Oct 2026