cargo-semver-checks 0.45.0

Scan your Rust crate for semver violations.
Documentation
SemverQuery(
    id: "unsafe_trait_method_requires_more_target_features",
    human_readable_name: "pub trait method requires more target features",
    description: "A trait method now requires additional CPU target features compared to the previous version.",
    required_update: Major,
    lint_level: Deny,
    reference_link: Some("https://doc.rust-lang.org/reference/attributes/codegen.html#the-target_feature-attribute"),
    query: r#"
    {
        CrateDiff {
            current {
                item {
                    ... on Trait {
                        visibility_limit @filter(op: "=", value: ["$public"])
                        name @output

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

                        method {
                            public_api_eligible @filter(op: "=", value: ["$true"])
                            method_name: name @output @tag

                            # We still want to lint even if the trait method has become safe.
                            currently_unsafe: unsafe @output

                            requires_feature {
                                explicit @filter(op: "=", value: ["$true"])
                                globally_enabled @filter(op: "=", value: ["$false"])
                                new_feature: name @output @tag
                            }

                            # Don't trigger the lint if the function became uncallable on the current target triple.
                            # We have a separate lint for that.
                            requires_feature @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) {
                                valid_for_current_target @filter(op: "=", value: ["$false"])
                            }

                            span_: span @optional {
                                filename @output
                                begin_line @output
                                end_line @output
                            }
                        }
                    }
                }
            }
            baseline {
                item {
                    ... on Trait {
                        visibility_limit @filter(op: "=", value: ["$public"])

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

                        method {
                            unsafe @filter(op: "=", value: ["$true"])
                            public_api_eligible @filter(op: "=", value: ["$true"])
                            name @filter(op: "=", value: ["%method_name"])

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

                            requires_feature @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) {
                                name @filter(op: "=", value: ["%new_feature"])
                            }

                            # Don't trigger the lint if the function wasn't callable on the current target triple.
                            # Nothing could have been using it here in the first place, so there's nothing to break.
                            requires_feature @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) {
                                valid_for_current_target @filter(op: "=", value: ["$false"])
                            }
                        }
                    }
                }
            }
        }
    }"#,
    arguments: {
        "public": "public",
        "true": true,
        "false": false,
        "zero": 0,
    },
    error_message: "A trait method now requires additional CPU target features to be enabled.",
    per_result_error_template: Some("{{name}}::{{method_name}} requires {{new_feature}} in {{span_filename}}:{{span_begin_line}}"),
    witness: None,
)