cargo-semver-checks 0.48.0

Scan your Rust crate for semver violations.
Documentation
SemverQuery(
    id: "exhaustive_struct_with_doc_hidden_fields_added",
    human_readable_name: "exhaustive pub struct with doc hidden fields added",
    description: "A new pub struct with #[doc(hidden)] fields was added.",
    required_update: Minor,
    lint_level: Allow,
    reference_link: Some("https://doc.rust-lang.org/reference/attributes/type_system.html#the-non_exhaustive-attribute"),
    query: r#"
    {
        CrateDiff {
            current {
                item {
                    ... on Struct {
                        visibility_limit @filter(op: "=", value: ["$public"]) @output
                        name @output

                        importable_path {
                            path @output @tag
                            public_api @filter(op: "=", value: ["$true"])
                        }

                        attrs @filter(op: "not_contains", value: ["$non_exhaustive"])

                        # Ensure there is no private fields.

                        field @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) {
                            visibility_limit @filter(op: "!=", value: ["$public"])
                        }

                        # Ensure the struct has at least one #[doc(hidden)] field.

                        field @fold @transform(op: "count") @filter(op: ">", value: ["$zero"]) {
                            public_api_eligible @filter(op: "!=", value: ["$true"])
                        }

                        span_: span @optional {
                            filename @output
                            begin_line @output
                        }
                    }
                }
            }
            baseline @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) {
                item {
                    ... on ImplOwner {
                        importable_path {
                            path @filter(op: "=", value: ["%path"])
                        }
                    }
                }
            }
        }
    }"#,
    arguments: {
        "public": "public",
        "zero": 0,
        "true": true,
        "non_exhaustive": "#[non_exhaustive]",
    },
    error_message: "A new pub struct with a #[doc(hidden)] field was added. Downstream crates can use non-public-API to exhaustively pattern-match the struct or construct it with a literal. If this isn't desirable, consider marking the struct #[non_exhaustive].",
    per_result_error_template: Some("struct {{join \"::\" path}} in file {{span_filename}}:{{span_begin_line}}"),
)