SemverQuery(
id: "pub_static_now_mutable",
human_readable_name: "pub static is now mutable",
description: "An immutable static became mutable and thus an unsafe block is required to use it",
required_update: Major,
lint_level: Deny,
reference_link: Some("https://google.github.io/comprehensive-rust/unsafe-rust/mutable-static.html"),
query: r#"
{
CrateDiff {
baseline {
item {
... on Static {
visibility_limit @filter(op: "=", value: ["$public"])
mutable @filter(op: "!=", value: ["$true"])
importable_path {
path @output @tag
public_api @filter(op: "=", value: ["$true"])
}
}
}
}
current {
item {
... on Static {
visibility_limit @filter(op: "=", value: ["$public"])
mutable @filter(op: "=", value: ["$true"])
static_name: name @output
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",
"true": true,
},
error_message: "An immutable static is now mutable and thus an unsafe block is required to use it",
per_result_error_template: Some("{{static_name}} in file {{span_filename}}:{{span_begin_line}}"),
)