Skip to content

Coverage instrumentation sometimes thinks the negation operator isn't executable #115468

Description

@Zalathar

#111752 introduced this behaviour in coverage reports:

   LL|       |    if
   LL|       |        !
   LL|      1|        is_true
   LL|      0|    {

Notice that the line with ! no longer has a coverage count, even though it should have the same count as is_true.


This is caused by the fact that MIR building specifically handles if ! by flipping the then/else arms, so the original condition expression (containing !) does not have its span represented by any statement in MIR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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