SemverQuery(
id: "trait_method_default_impl_removed",
human_readable_name: "pub trait default method impl removed",
description: "A non-sealed public trait default method impl was removed",
required_update: Major,
lint_level: Deny,
reference_link: Some("https://doc.rust-lang.org/book/ch10-02-traits.html#default-implementations"),
query: r#"
{
CrateDiff {
baseline {
item {
... on Trait {
visibility_limit @filter(op: "=", value: ["$public"]) @output
public_api_sealed @filter(op: "!=", value: ["$true"])
name @output
importable_path {
path @output @tag
public_api @filter(op: "=", value: ["$true"])
}
method {
method_name: name @output @tag
public_api_eligible @filter(op: "=", value: ["$true"])
has_body @filter(op: "=", value: ["$true"])
}
}
}
}
current {
item {
... on Trait {
visibility_limit @filter(op: "=", value: ["$public"])
importable_path {
path @filter(op: "=", value: ["%path"])
public_api @filter(op: "=", value: ["$true"])
}
method {
public_api_eligible @filter(op: "=", value: ["$true"])
name @filter(op: "=", value: ["%method_name"])
has_body @filter(op: "!=", value: ["$true"])
span_: span @optional {
filename @output
begin_line @output
end_line @output
}
}
}
}
}
}
}"#,
arguments: {
"true": true,
"public": "public",
},
error_message: "A method's default impl in an unsealed trait has been removed, breaking trait implementations that relied on that default",
per_result_error_template: Some("trait method {{join \"::\" path}}::{{method_name}} in file {{span_filename}}:{{span_begin_line}}"),
)