SemverQuery(
id: "method_export_name_changed",
human_readable_name: "method's export name has changed or been removed",
description: "A public inherent method's ABI name assigned via #[no_mangle] or #[export_name = \"name\"] has changed or been removed.",
required_update: Major,
lint_level: Deny,
reference_link: Some("https://doc.rust-lang.org/reference/abi.html#the-no_mangle-attribute"),
query: r#"
{
CrateDiff {
baseline {
item {
... on ImplOwner {
visibility_limit @filter(op: "=", value: ["$public"])
importable_path {
path @tag @output
public_api @filter(op: "=", value: ["$true"])
}
inherent_impl {
method {
method_name: name @tag @output
public_api_eligible @filter(op: "=", value: ["$true"])
export_name @output @tag @filter(op: "is_not_null")
}
}
}
}
}
current {
item {
... on ImplOwner {
visibility_limit @filter(op: "=", value: ["$public"])
importable_path {
path @filter(op: "=", value: ["%path"])
public_api @filter(op: "=", value: ["$true"])
}
inherent_impl {
method {
name @filter(op: "=", value: ["%method_name"])
public_api_eligible @filter(op: "=", value: ["$true"])
new_export_name: export_name @filter(op: "!=", value: ["%export_name"]) @output
span_: span @optional {
filename @output
begin_line @output
end_line @output
}
}
}
}
}
}
}
}"#,
arguments: {
"public": "public",
"true": true,
},
error_message: "A method that was accessible via both the public API and an ABI export is no longer accessible via the same ABI symbol name. The ABI and public API have diverged.",
per_result_error_template: Some("{{join \"::\" path}}::{{method_name}} no longer has ABI name {{export_name}} in {{span_filename}}:{{span_begin_line}}"),
witness: None,
)