diff --git a/src/tools/tidy/src/bins.rs b/src/tools/tidy/src/bins.rs index 84d3ff2b238..43475f203d5 100644 --- a/src/tools/tidy/src/bins.rs +++ b/src/tools/tidy/src/bins.rs @@ -35,7 +35,7 @@ pub fn check(path: &Path, bad: &mut bool) { return } - let metadata = t!(fs::metadata(&file)); + let metadata = t!(fs::metadata(&file), &file); if metadata.mode() & 0o111 != 0 { println!("binary checked into source: {}", file.display()); *bad = true; diff --git a/src/tools/tidy/src/cargo.rs b/src/tools/tidy/src/cargo.rs index a170ecfdce0..77dcf9c1bd8 100644 --- a/src/tools/tidy/src/cargo.rs +++ b/src/tools/tidy/src/cargo.rs @@ -20,7 +20,7 @@ use std::fs::File; use std::path::Path; pub fn check(path: &Path, bad: &mut bool) { - for entry in t!(path.read_dir()).map(|e| t!(e)) { + for entry in t!(path.read_dir(), path).map(|e| t!(e)) { // Look for `Cargo.toml` with a sibling `src/lib.rs` or `lib.rs` if entry.file_name().to_str() == Some("Cargo.toml") { if path.join("src/lib.rs").is_file() { diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index 85b9c345e19..e9e2508aba9 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -19,6 +19,11 @@ use std::path::{PathBuf, Path}; use std::env; macro_rules! t { + ($e:expr, $p:expr) => (match $e { + Ok(e) => e, + Err(e) => panic!("{} failed on {} with {}", stringify!($e), ($p).display(), e), + }); + ($e:expr) => (match $e { Ok(e) => e, Err(e) => panic!("{} failed with {}", stringify!($e), e), @@ -63,7 +68,7 @@ fn filter_dirs(path: &Path) -> bool { fn walk(path: &Path, skip: &mut FnMut(&Path) -> bool, f: &mut FnMut(&Path)) { - for entry in t!(fs::read_dir(path)) { + for entry in t!(fs::read_dir(path), path) { let entry = t!(entry); let kind = t!(entry.file_type()); let path = entry.path(); diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index 4c5f72c1e79..61230b3b030 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -52,7 +52,7 @@ pub fn check(path: &Path, bad: &mut bool) { } contents.truncate(0); - t!(t!(File::open(file)).read_to_string(&mut contents)); + t!(t!(File::open(file), file).read_to_string(&mut contents)); let skip_cr = contents.contains("ignore-tidy-cr"); let skip_tab = contents.contains("ignore-tidy-tab"); let skip_length = contents.contains("ignore-tidy-linelength");