Skip to content

Missing coverage on assert!(!...) statements #118904

Closed
@EFanZh

Description

@EFanZh

I tried this code:

fn main() {
    assert!(!false);
}

I expected to see this happen: Run this program with cargo-llvm-cov: cargo llvm-cov run --html, I expect the source code should be fully covered.

Instead, this happened: The assert! part in the source code is not covered. But if I change !false to true, the source will be fully covered, it seems that I can’t get assert! to be covered as long as the argument starts with an ! operator.

Meta

rustc --version --verbose:

rustc 1.76.0-nightly (f967532a4 2023-12-08)
binary: rustc
commit-hash: f967532a47eb728ada44473a5c4c2eca1a45fe30
commit-date: 2023-12-08
host: x86_64-pc-windows-msvc
release: 1.76.0-nightly
LLVM version: 17.0.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-code-coverageArea: Source-based code coverage (-Cinstrument-coverage)C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions