|
| 1 | +SemverQuery( |
| 2 | + id: "type_associated_const_marked_deprecated", |
| 3 | + human_readable_name: "type's associated constant #[deprecated] added", |
| 4 | + description: "An inherent associated constant has been newly marked with #[deprecated].", |
| 5 | + required_update: Minor, |
| 6 | + lint_level: Deny, |
| 7 | + reference_link: Some("https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute"), |
| 8 | + query: r#" |
| 9 | + { |
| 10 | + CrateDiff { |
| 11 | + current { |
| 12 | + item { |
| 13 | + ... on ImplOwner { |
| 14 | + visibility_limit @filter(op: "=", value: ["$public"]) |
| 15 | + name @output |
| 16 | + owner_type: __typename @tag @output |
| 17 | +
|
| 18 | + importable_path { |
| 19 | + path @tag @output |
| 20 | + public_api @filter(op: "=", value: ["$true"]) |
| 21 | + } |
| 22 | +
|
| 23 | + inherent_impl { |
| 24 | + public_api_eligible @filter(op: "=", value: ["$true"]) |
| 25 | + |
| 26 | + associated_constant { |
| 27 | + associated_constant: name @output @tag |
| 28 | + public_api_eligible @filter(op: "=", value: ["$true"]) |
| 29 | + deprecated @filter(op: "=", value: ["$true"]) |
| 30 | +
|
| 31 | + span_: span @optional { |
| 32 | + filename @output |
| 33 | + begin_line @output |
| 34 | + end_line @output |
| 35 | + } |
| 36 | + } |
| 37 | + } |
| 38 | + } |
| 39 | + } |
| 40 | + } |
| 41 | + baseline { |
| 42 | + item { |
| 43 | + ... on ImplOwner { |
| 44 | + visibility_limit @filter(op: "=", value: ["$public"]) |
| 45 | + __typename @filter(op: "=", value: ["%owner_type"]) |
| 46 | +
|
| 47 | + importable_path { |
| 48 | + path @filter(op: "=", value: ["%path"]) |
| 49 | + public_api @filter(op: "=", value: ["$true"]) |
| 50 | + } |
| 51 | +
|
| 52 | + inherent_impl { |
| 53 | + public_api_eligible @filter(op: "=", value: ["$true"]) |
| 54 | +
|
| 55 | + associated_constant { |
| 56 | + name @filter(op: "=", value: ["%associated_constant"]) |
| 57 | + public_api_eligible @filter(op: "=", value: ["$true"]) |
| 58 | + deprecated @filter(op: "!=", value: ["$true"]) |
| 59 | + } |
| 60 | + } |
| 61 | + } |
| 62 | + } |
| 63 | + } |
| 64 | + } |
| 65 | + }"#, |
| 66 | + arguments: { |
| 67 | + "public": "public", |
| 68 | + "true": true, |
| 69 | + }, |
| 70 | + error_message: "A type's associated constant is now #[deprecated]. Downstream crates will get a compiler warning when using it.", |
| 71 | + per_result_error_template: Some("associated constant {{join \"::\" path}}::{{associated_constant}} in {{span_filename}}:{{span_begin_line}}"), |
| 72 | +) |
0 commit comments