/
variant_marked_non_exhaustive.ron
62 lines (57 loc) · 2.56 KB
/
variant_marked_non_exhaustive.ron
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
SemverQuery(
id: "variant_marked_non_exhaustive",
human_readable_name: "enum variant marked #[non_exhaustive]",
description: "An exhaustive enum variant has been marked #[non_exhaustive].",
reference: Some("An exhaustive enum variant has been marked #[non_exhaustive], preventing it from being constructed using a literal from outside its own crate."),
required_update: Major,
reference_link: Some("https://doc.rust-lang.org/cargo/reference/semver.html#attr-adding-non-exhaustive"),
query: r#"
{
CrateDiff {
baseline {
item {
... on Enum {
visibility_limit @filter(op: "=", value: ["$public"]) @output
importable_path {
path @output @tag
public_api @filter(op: "=", value: ["$true"])
}
variant {
variant_name: name @output @tag
public_api_eligible @filter(op: "=", value: ["$true"])
attrs @filter(op: "not_contains", value: ["$non_exhaustive"])
}
}
}
}
current {
item {
... on Enum {
visibility_limit @filter(op: "=", value: ["$public"])
name @output
importable_path {
path @filter(op: "=", value: ["%path"])
public_api @filter(op: "=", value: ["$true"])
}
variant {
name @filter(op: "=", value: ["%variant_name"])
public_api_eligible @filter(op: "=", value: ["$true"])
attrs @filter(op: "contains", value: ["$non_exhaustive"])
span_: span @optional {
filename @output
begin_line @output
}
}
}
}
}
}
}"#,
arguments: {
"public": "public",
"non_exhaustive": "#[non_exhaustive]",
"true": true,
},
error_message: "A public enum's variant has been marked #[non_exhaustive], which will prevent it from being constructed using a literal outside of its crate.",
per_result_error_template: Some("variant {{name}}:{{variant_name}} in {{span_filename}}:{{span_begin_line}}"),
)