Skip to content

Code coverage (-Zinstrument-coverage) showing #[derive(Eq)] as a missed region, even though Eq has no functions #83601

Closed
@ThePuzzlemaker

Description

@ThePuzzlemaker

I tried this code:

#[derive(Debug, PartialEq, Eq)]
struct Foo(u32);

fn main() {
    assert_eq!(Foo(1), Foo(1));
    assert_ne!(Foo(0), Foo(1));
    println!("{:?}", Foo(1));
}

Running these commands to get the code coverage report:

$ env RUSTFLAGS="-Zinstrument-coverage" CARGO_INCREMENTAL=0 cargo run
$ cargo profdata -- merge default.profraw -o default.profdata
$ cargo cov -- show --use-color --instr-profile=calypso.profdata --object target/debug/codecov-testing --show-instantiations --show-line-counts-or-regions --Xdemangler=rustfilt

This provides this report:

    1|      4|#[derive(Debug, PartialEq, Eq)]
                       ^2                ^0
  ------------------
  | <codecov_testing::Foo as core::cmp::PartialEq>::eq:
  |    1|      4|#[derive(Debug, PartialEq, Eq)]
  ------------------

I expected to see this happen: Eq is not marked as a missed region

Instead, this happened: Eq is marked as a missed region (the ^0). I'm guessing this is because of the internal assert_receiver_is_total_eq function on Eq.

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (07e0e2ec2 2021-03-24)
binary: rustc
commit-hash: 07e0e2ec268c140e607e1ac7f49f145612d0f597
commit-date: 2021-03-24
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0

Backtrace not applicable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-code-coverageArea: Source-based code coverage (-Cinstrument-coverage)C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions