Skip to content

Commit 356b812

Browse files
committed
fix incorrect path resolution in tidy
Previously, reading the current path from the environment led to failure when invoking x from outside the source root. This change fixes this issue by reading the second argument, which always equals to the source root (see https://github.com/rust-lang/rust/blob/a655e648a9f94d74263108366b83e677af56e35d/src/bootstrap/src/core/build_steps/test.rs#L1081). Signed-off-by: onur-ozkan <[email protected]>
1 parent 735f758 commit 356b812

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/tools/tidy/src/ui_tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use ignore::Walk;
55
use lazy_static::lazy_static;
66
use regex::Regex;
77
use std::collections::{BTreeSet, HashMap};
8+
use std::env;
89
use std::ffi::OsStr;
910
use std::fs;
1011
use std::io::Write;
@@ -184,7 +185,7 @@ pub fn check(path: &Path, bless: bool, bad: &mut bool) {
184185
*/
185186
[
186187
"#;
187-
let tidy_src = std::env::current_dir().unwrap().join("src/tools/tidy/src");
188+
let tidy_src = PathBuf::from(env::args_os().nth(1).unwrap()).join("src/tools/tidy/src");
188189
// instead of overwriting the file, recreate it and use an "atomic rename"
189190
// so we don't bork things on panic or a contributor using Ctrl+C
190191
let blessed_issues_path = tidy_src.join("issues_blessed.txt");

0 commit comments

Comments
 (0)