SemverQuery(
id: "inherent_method_changed_abi",
human_readable_name: "inherent method changed ABI",
description: "A public inherent method changed its external ABI.",
required_update: Major,
lint_level: Deny,
reference_link: Some("https://doc.rust-lang.org/reference/items/external-blocks.html#abi"),
query: r#"
{
CrateDiff {
baseline {
item {
... on ImplOwner {
visibility_limit @filter(op: "=", value: ["$public"])
owner_type: __typename @tag @output
name @output
importable_path {
path @tag @output
public_api @filter(op: "=", value: ["$true"])
}
inherent_impl {
method {
visibility_limit @filter(op: "=", value: ["$public"])
public_api_eligible @filter(op: "=", value: ["$true"])
method_name: name @output @tag
baseline_abi_: abi {
name @output @tag
raw_name @output
}
}
}
}
}
}
current {
item {
... on ImplOwner {
__typename @filter(op: "=", value: ["%owner_type"])
visibility_limit @filter(op: "=", value: ["$public"])
importable_path {
path @filter(op: "=", value: ["%path"])
public_api @filter(op: "=", value: ["$true"])
}
inherent_impl {
method {
visibility_limit @filter(op: "=", value: ["$public"])
name @filter(op: "=", value: ["%method_name"])
public_api_eligible @filter(op: "=", value: ["$true"])
new_abi_: abi {
name @filter(op: "!=", value: ["%name"]) @output
raw_name @output
}
span_: span @optional {
filename @output
begin_line @output
end_line @output
}
}
}
}
}
}
}
}"#,
arguments: {
"public": "public",
"true": true,
},
error_message: "An inherent method changed its ABI.",
per_result_error_template: Some("{{join \"::\" path}}::{{method_name}} changed ABI from {{baseline_abi_raw_name}} to {{new_abi_raw_name}} in {{span_filename}}:{{span_begin_line}}"),
// Idea for what the witness looks like:
// https://github.com/obi1kenobi/cargo-semver-checks/issues/1281
witness: None,
)