Skip to content

Confusing coverage result: Uncovered argument for match #3456

Description

@adpaco

We noticed a confusing coverage result in #3119 where, for the code

fn print_direction(dir: Direction) {
    // For some reason, `dir`'s span is reported as `UNCOVERED` too
    match dir {
        Direction::Up => println!("Going up!"),
        Direction::Down => println!("Going down!"),
        Direction::Left => println!("Going left!"),
        Direction::Right if 1 == 1 => println!("Going right!"),
        // This part is unreachable since we cover all variants in the match.
        _ => println!("Not going anywhere!"),
    }
}

we get the result

main.rs (print_direction)\
 * 14:1 - 14:36 COVERED
 * 16:11 - 16:14 UNCOVERED
 * 17:26 - 17:47 UNCOVERED
 * 18:28 - 18:51 UNCOVERED
 * 19:28 - 19:51 COVERED
 * 20:34 - 20:63 UNCOVERED
 * 22:14 - 22:45 UNCOVERED
 * 24:1 - 24:2 COVERED

which is confusing because it reports the dir in match dir { as UNCOVERED. It's not clear to me why this is happening, but we should at least check if this is also the case for a standard execution with coverage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Z-UnstableFeatureIssues that only occur if a unstable feature is enabled[C] BugThis is a bug. Something isn't working.[E] User ExperienceAn UX enhancement for an existing feature. Including deprecation of an existing one.[F] Spurious FailureIssues that cause Kani verification to fail despite the code being correct.

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions