cargo-semver-checks 0.48.0

Scan your Rust crate for semver violations.
Documentation
SemverQuery(
    id: "union_missing",
    human_readable_name: "pub union removed or renamed",
    description: "A union can no longer be imported by its prior path.",
    required_update: Major,
    lint_level: Deny,
    reference_link: Some("https://doc.rust-lang.org/cargo/reference/semver.html#item-remove"),
    query: r#"
    {
        CrateDiff {
            baseline {
                item {
                    ... on Union {
                        visibility_limit @filter(op: "=", value: ["$public"]) @output
                        name @output

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

                        span_: span @optional {
                            filename @output
                            begin_line @output
                            end_line @output
                        }
                    }
                }
            }
            current {
                item @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) {
                    # If the union still exists but is no longer public API, union_now_doc_hidden
                    # will report it. Don't report it as missing in that case.
                    ... on Union {
                        visibility_limit @filter(op: "=", value: ["$public"])

                        importable_path {
                            path @filter(op: "=", value: ["%path"])
                        }
                    }
                }
                # If the union's path is now a struct/enum/trait, that's covered by
                # union_changed_kind, union_with_multiple_pub_fields_changed_to_struct, or
                # union_changed_to_incompatible_struct instead of reporting it as missing.
                item @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) {
                    ... on ImplOwner {
                        __typename @filter(op: "!=", value: ["$union"])
                        visibility_limit @filter(op: "=", value: ["$public"])

                        importable_path {
                            path @filter(op: "=", value: ["%path"])
                            public_api @filter(op: "=", value: ["$true"])
                        }
                    }
                }
                item @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) {
                    ... on Trait {
                        visibility_limit @filter(op: "=", value: ["$public"])

                        importable_path {
                            path @filter(op: "=", value: ["%path"])
                            public_api @filter(op: "=", value: ["$true"])
                        }
                    }
                }
            }
        }
    }"#,
    arguments: {
        "public": "public",
        "zero": 0,
        "true": true,
        "union": "Union",
    },
    error_message: "A publicly-visible union cannot be imported by its prior path. A `pub use` may have been removed, or the union itself may have been renamed or removed entirely.",
    per_result_error_template: Some("union {{join \"::\" path}}, previously in file {{span_filename}}:{{span_begin_line}}"),
)