rust-lang / rust-lang/rust

Coverage behavioral changes on #[derive] lines

Open
#147,434 14 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-code-coverage C-bug regression-from-stable-to-stable T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

We are seeing changes in coverage behavior in 1.83, 1.84-1.90, and beta/nightly. This code:

use asn1::Asn1Read;

#[derive(Asn1Read)]
struct ThreeIntegers {
    first: u64,
    second: u64,
    third: u64,
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_parse_and_serialize() {
        // This represents SEQUENCE { INTEGER 1, INTEGER 2, INTEGER 3 }
        let der_data = b"\x30\x09\x02\x01\x01\x02\x01\x02\x02\x01\x03";

        // Parse the DER data
        let parsed: ThreeIntegers = asn1::parse_single(der_data)
            .expect("Failed to parse DER data");
        assert_eq!(parsed.first, 1);
        assert_eq!(parsed.second, 2);
        assert_eq!(parsed.third, 3);
    }
}

with this Cargo.toml

[package]
name = "rust-asn1-project"
version = "0.1.0"
edition = "2021"

[dependencies]
asn1 = "0.22.0"

has coverage in 1.83.0 when run with cargo llvm-cov --html (which of course requires llvm-tools-preview).

Image

But in 1.84-1.90 it shows as uncovered.
Image

And in beta and nightly this now doesn't show as a line at all:

Image

Since this has changed multiple times now (covered -> uncovered -> not a line at all) I'm filing this issue to verify that the beta/nightly behavior is expected and won't change again in the future.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example from the issue using the shown Cargo.toml and cargo llvm-cov across Rust 1.83, stable versions, beta, and nightly. Compare how the #[derive(Asn1Read)] lines are reported, then check the compiler coverage behavior and existing coverage tests to determine whether the beta/nightly result is expected and stable.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.