SemverQuery(
id: "enum_marked_non_exhaustive",
human_readable_name: "enum marked #[non_exhaustive]",
description: "An exhaustive enum has been marked #[non_exhaustive].",
reference: Some("An exhaustive enum has been marked #[non_exhaustive]. Pattern-matching on it outside of its crate must now include a wildcard pattern like `_`, or it will fail to compile."),
required_update: Major,
reference_link: Some("https://doc.rust-lang.org/cargo/reference/semver.html#attr-adding-non-exhaustive"),
query: r#"
{
CrateDiff {
current {
item {
... on Enum {
visibility_limit @filter(op: "=", value: ["$public"]) @output
name @output
attrs @filter(op: "contains", value: ["$non_exhaustive"])
importable_path {
path @output @tag
}
span_: span @optional {
filename @output
begin_line @output
}
}
}
}
baseline {
item {
... on Enum {
visibility_limit @filter(op: "=", value: ["$public"])
attrs @filter(op: "not_contains", value: ["$non_exhaustive"])
importable_path {
path @filter(op: "=", value: ["%path"])
}
}
}
}
}
}"#,
arguments: {
"public": "public",
"non_exhaustive": "#[non_exhaustive]",
},
error_message: "A public enum has been marked #[non_exhaustive]. Pattern-matching on it outside of its crate must now include a wildcard pattern like `_`, or it will fail to compile.",
per_result_error_template: Some("enum {{name}} in {{span_filename}}:{{span_begin_line}}"),
)