SemverQuery(
id: "method_receiver_ref_became_owned",
human_readable_name: "method receiver changed from immutable reference to owned value",
description: "A method's receiver changed from &self to self, transferring ownership as part of the call.",
required_update: Major,
lint_level: Deny,
reference_link: Some("https://doc.rust-lang.org/reference/items/associated-items.html#methods"),
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
receiver {
by_reference @filter(op: "=", value: ["$true"])
receiver_kind: kind @tag @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"])
receiver {
by_value @filter(op: "=", value: ["$true"])
kind @filter(op: "=", value: ["%receiver_kind"])
}
span_: span @optional {
filename @output
begin_line @output
end_line @output
}
}
}
}
}
}
}
}"#,
arguments: {
"public": "public",
"true": true,
},
error_message: "A method's receiver changed from an immutable reference to an owned value. Ownership is transferred as part of the call, which is a breaking change.",
per_result_error_template: Some("{{join \"::\" path}}::{{method_name}} now takes {{receiver_kind}}, not &{{receiver_kind}}, in {{span_filename}}:{{span_begin_line}}"),
witness: None,
)