SemverQuery(
id: "repr_packed_changed",
human_readable_name: "repr(packed(N)) changed",
description: "A struct or union changed its repr(packed) alignment value.",
required_update: Major,
lint_level: Deny,
reference_link: Some("https://doc.rust-lang.org/cargo/reference/semver.html#repr-packed-n-change"),
query: r#"
{
CrateDiff {
baseline {
item {
... on ImplOwner {
type: __typename @filter(op: "one_of", value: ["$types"]) @output @tag
visibility_limit @filter(op: "=", value: ["$public"])
attribute {
content {
base @filter(op: "=", value: ["$repr"])
argument {
base @filter(op: "=", value: ["$packed"])
argument {
old_packed: raw_item @output @tag(name: "old_packed")
}
}
}
}
importable_path {
path @output @tag
public_api @filter(op: "=", value: ["$true"])
}
}
}
}
current {
item {
... on ImplOwner {
__typename @filter(op: "=", value: ["%type"])
visibility_limit @filter(op: "=", value: ["$public"])
name @output
attribute {
content {
base @filter(op: "=", value: ["$repr"])
argument {
base @filter(op: "=", value: ["$packed"])
argument {
raw_item @filter(op: "!=", value: ["%old_packed"]) @output(name: "new_packed")
}
}
}
}
importable_path {
path @filter(op: "=", value: ["%path"])
public_api @filter(op: "=", value: ["$true"])
}
span_: span @optional {
filename @output
begin_line @output
end_line @output
}
}
}
}
}
}"#,
arguments: {
"public": "public",
"repr": "repr",
"packed": "packed",
"true": true,
"types": ["Struct", "Union"],
},
error_message: "The declared repr(packed) alignment for a type has changed. This can break code that depends on the type's alignment or layout.",
per_result_error_template: Some("{{lowercase type}} {{name}} changed from #[repr(packed({{old_packed}}))] to #[repr(packed({{new_packed}}))] in {{span_filename}}:{{span_begin_line}}"),
witness: None,
)