Skip to content

Commit 5efb3f8

Browse files
Pass src_path to rustdoc_json tidy check
1 parent 115523e commit 5efb3f8

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/tools/tidy/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fn main() {
110110
check!(rustdoc_css_themes, &librustdoc_path);
111111
check!(rustdoc_templates, &librustdoc_path);
112112
check!(rustdoc_js, &librustdoc_path, &tools_path, &src_path);
113-
check!(rustdoc_json);
113+
check!(rustdoc_json, &src_path);
114114
check!(known_bug, &crashes_path);
115115
check!(unknown_revision, &tests_path);
116116

src/tools/tidy/src/rustdoc_json.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
//! Tidy check to ensure that `FORMAT_VERSION` was correctly updated if `rustdoc-json-types` was
22
//! updated as well.
33
4+
use std::ffi::OsStr;
5+
use std::path::Path;
46
use std::process::Command;
57

68
use build_helper::ci::CiEnv;
79
use build_helper::git::{GitConfig, get_closest_upstream_commit};
810
use build_helper::stage0_parser::parse_stage0_file;
911

10-
fn git_diff(base_commit: &str, extra_arg: &str) -> Option<String> {
12+
fn git_diff<S: AsRef<OsStr>>(base_commit: &str, extra_arg: S) -> Option<String> {
1113
let output = Command::new("git").arg("diff").arg(base_commit).arg(extra_arg).output().ok()?;
1214
let s = String::from_utf8_lossy(&output.stdout).into();
1315
println!("+++++++++++> {s}");
1416
Some(s)
1517
}
1618

17-
pub fn check(bad: &mut bool) {
19+
pub fn check(src_path: &Path, bad: &mut bool) {
1820
println!("Checking tidy rustdoc_json...");
1921
let stage0 = parse_stage0_file();
2022
let base_commit = match get_closest_upstream_commit(
@@ -58,7 +60,7 @@ pub fn check(bad: &mut bool) {
5860
}
5961
}
6062
// Then we check that if `FORMAT_VERSION` was updated, the `Latest feature:` was also updated.
61-
match git_diff(&base_commit, "src/rustdoc-json-types") {
63+
match git_diff(&base_commit, src_path.join("rustdoc-json-types")) {
6264
Some(output) => {
6365
let mut format_version_updated = false;
6466
let mut latest_feature_comment_updated = false;

0 commit comments

Comments
 (0)