-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Semver-check for functions being removed. (#22)
* Add Function and Method types to the schema. * Add semver check for functions being removed.
- Loading branch information
1 parent
052df74
commit 78e88f3
Showing
9 changed files
with
219 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
/// Testing: <https://doc.rust-lang.org/cargo/reference/semver.html#item-remove> | ||
//! Testing: <https://doc.rust-lang.org/cargo/reference/semver.html#item-remove> | ||
#[cfg(not(feature = "struct_missing"))] | ||
pub struct WillBeRemovedStruct; | ||
|
||
/// Testing: <https://doc.rust-lang.org/cargo/reference/semver.html#item-remove> | ||
#[cfg(not(feature = "enum_missing"))] | ||
pub enum WillBeRemovedEnum {} | ||
|
||
#[cfg(not(feature = "function_missing"))] | ||
pub fn will_be_removed_fn() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
SemverQuery( | ||
id: "function_missing", | ||
human_readable_name: "pub fn removed or renamed", | ||
description: "A publicly-visible function is no longer available under its prior name, which is a major breaking change for code that depends on it.", | ||
required_update: Major, | ||
reference_link: Some("https://doc.rust-lang.org/cargo/reference/semver.html#item-remove"), | ||
query: r#" | ||
{ | ||
CrateDiff { | ||
baseline { | ||
item { | ||
... on Function { | ||
visibility_limit @filter(op: "=", value: ["$public"]) @output | ||
name @output @tag | ||
path { | ||
path @output @tag | ||
} | ||
span_: span @optional { | ||
filename @output | ||
begin_line @output | ||
} | ||
} | ||
} | ||
} | ||
current @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) { | ||
item { | ||
... on Function { | ||
visibility_limit @filter(op: "=", value: ["$public"]) | ||
name @filter(op: "=", value: ["%name"]) | ||
path { | ||
path @filter(op: "=", value: ["%path"]) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}"#, | ||
arguments: { | ||
"public": "public", | ||
"zero": 0, | ||
}, | ||
error_message: "A publicly-visible function is no longer available under its prior name. It may have been renamed or removed entirely.", | ||
per_result_error_template: Some("function {{name}}, previously in file {{span_filename}}:{{span_begin_line}}"), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.