cargo-semver-checks 0.45.0

Scan your Rust crate for semver violations.
Documentation
SemverQuery(
    id: "macro_no_longer_exported",
    human_readable_name: "macro is no longer exported",
    description: "A macro_rules macro that was previously exported is no longer exported.",
    required_update: Major,
    lint_level: Deny,
    reference_link: Some("https://doc.rust-lang.org/reference/macros-by-example.html#path-based-scope"),
    query: r#"
    {
        CrateDiff {
            baseline {
                item {
                    ... on Macro {
                        name @output @tag

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

                        span_: span @optional {
                            filename @output
                            begin_line @output
                        }
                    }
                }
            }
            current {
                # There's no exported macro under the name we wanted.
                item @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) {
                    ... on Macro {
                        name @filter(op: "=", value: ["%name"])

                        importable_path {
                            path @filter(op: "=", value: ["%path"])
                        }
                    }
                }

                # There is at least one macro under the same name that is *not* exported.
                # Perhaps the macro is not deleted, just no longer exported.
                item @fold @transform(op: "count") @filter(op: ">", value: ["$zero"]) {
                    ... on Macro {
                        name @filter(op: "=", value: ["%name"])

                        # Check the macro still exists but is no longer public API
                        # and isn't doc(hidden) (which would be caught by another lint)
                        public_api_eligible @filter(op: "!=", value: ["$true"])
                        doc_hidden @filter(op: "!=", value: ["$true"])

                        non_exported_span_: span @optional {
                            filename @output
                            begin_line @output
                            end_line @output
                        }
                    }
                }
            }
        }
    }"#,
    arguments: {
        "true": true,
        "zero": 0,
    },
    error_message: "A `macro_rules!` declarative macro that was previously exported with `#[macro_export]` is no longer exported. This breaks downstream code that used the macro.",
    per_result_error_template: Some("macro {{name}} in {{span_filename}}:{{span_begin_line}}"),
    witness: Some((
        hint_template: r#"{{name}}!(...);"#,
    )),
)