SemverQuery(
id: "struct_kind_changed",
human_readable_name: "pub struct changed kind (plain / tuple / unit)",
description: "A publicly-visible struct has changed to another kind of struct (plain / tuple / unit struct), which is a major breaking change for code that depends on it.",
required_update: Major,
query: r#"
{
CrateDiff {
baseline {
item {
... on Struct {
visibility_limit @filter(op: "=", value: ["$public"])
struct_name: name @output @tag
prior_kind: struct_type @output @tag
baseline_span_: span @optional {
filename @output
begin_line @output
}
}
}
}
current {
item {
... on Struct {
visibility_limit @filter(op: "=", value: ["$public"])
name @filter(op: "=", value: ["%struct_name"])
found_kind: struct_type @filter(op: "!=", value: ["%prior_kind"]) @output
found_span_: span @optional {
filename @output
begin_line @output
}
}
}
}
}
}"#,
arguments: {
"public": "public",
},
error_message: "A publicly-visible struct has changed from one kind (plain / tuple / unit) to another.",
)