Skip to content

Coverage behavioral changes on #[derive] lines #147434

@reaperhulk

Description

@reaperhulk

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-code-coverageArea: Source-based code coverage (-Cinstrument-coverage)C-bugCategory: This is a bug.I-prioritizeIssue: Indicates that prioritization has been requested for this issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions