forked from obi1kenobi/cargo-semver-checks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpub_api_sealed_trait_became_unsealed.ron
54 lines (51 loc) · 2.2 KB
/
pub_api_sealed_trait_became_unsealed.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
SemverQuery(
id: "pub_api_sealed_trait_became_unsealed",
human_readable_name: "public API sealed trait became unsealed",
description: "A public API sealed trait has become unsealed, allowing downstream crates to implement it. Reverting this would be a major breaking change.",
required_update: Minor,
lint_level: Warn,
reference_link: Some("https://rust-lang.github.io/api-guidelines/future-proofing.html#sealed-traits-protect-against-downstream-implementations-c-sealed"),
query: r#"
{
CrateDiff {
baseline {
item {
... on Trait {
visibility_limit @filter(op: "=", value: ["$public"]) @output
public_api_sealed @filter(op: "=", value: ["$true"])
unconditionally_sealed @filter(op: "!=", value: ["$true"])
importable_path {
path @output @tag
public_api @filter(op: "=", value: ["$true"])
}
}
}
}
current {
item {
... on Trait {
visibility_limit @filter(op: "=", value: ["$public"])
public_api_sealed @filter(op: "!=", value: ["$true"])
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: "A public API sealed trait has become unsealed, allowing downstream crates to implement it. Reverting this would be a major breaking change.",
per_result_error_template: Some("trait {{join \"::\" path}} in file {{span_filename}}:{{span_begin_line}}"),
witness: None,
)