SemverQuery(
id: "function_parameter_count_changed",
human_readable_name: "pub fn parameter count changed",
description: "Parameter count of a function has changed.",
required_update: Major,
reference_link: Some("https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity"),
query: r#"
{
CrateDiff {
baseline {
item {
... on Function {
visibility_limit @filter(op: "=", value: ["$public"]) @output
importable_path {
path @output @tag
public_api @filter(op: "=", value: ["$true"])
}
old_parameter_: parameter @fold @transform(op: "count") @output @tag(name: "parameters")
}
}
}
current {
item {
... on Function {
visibility_limit @filter(op: "=", value: ["$public"])
name @output
current_parameter_: parameter @fold @transform(op: "count") @filter(op: "!=", value: ["%parameters"]) @output
importable_path {
path @filter(op: "=", value: ["%path"])
public_api @filter(op: "=", value: ["$true"])
}
span_: span @optional {
filename @output
begin_line @output
}
}
}
}
}
}"#,
arguments: {
"public": "public",
"true": true,
},
error_message: "A publicly-visible function now takes a different number of parameters.",
per_result_error_template: Some("{{join \"::\" path}} now takes {{current_parameter_count}} parameters instead of {{old_parameter_count}}, in {{span_filename}}:{{span_begin_line}}"),
)