summaryrefslogtreecommitdiffstats
path: root/src/tools/tidy/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/tidy/src/main.rs')
-rw-r--r--src/tools/tidy/src/main.rs23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs
index 505f9d724..f59406c40 100644
--- a/src/tools/tidy/src/main.rs
+++ b/src/tools/tidy/src/main.rs
@@ -13,7 +13,7 @@ use std::path::PathBuf;
use std::process;
use std::str::FromStr;
use std::sync::atomic::{AtomicBool, Ordering};
-use std::thread::{scope, ScopedJoinHandle};
+use std::thread::{self, scope, ScopedJoinHandle};
fn main() {
let root_path: PathBuf = env::args_os().nth(1).expect("need path to root of repo").into();
@@ -55,16 +55,28 @@ fn main() {
VecDeque::with_capacity(concurrency.get());
macro_rules! check {
- ($p:ident $(, $args:expr)* ) => {
+ ($p:ident) => {
+ check!(@ $p, name=format!("{}", stringify!($p)));
+ };
+ ($p:ident, $path:expr $(, $args:expr)* ) => {
+ let shortened = $path.strip_prefix(&root_path).unwrap();
+ let name = if shortened == std::path::Path::new("") {
+ format!("{} (.)", stringify!($p))
+ } else {
+ format!("{} ({})", stringify!($p), shortened.display())
+ };
+ check!(@ $p, name=name, $path $(,$args)*);
+ };
+ (@ $p:ident, name=$name:expr $(, $args:expr)* ) => {
drain_handles(&mut handles);
- let handle = s.spawn(|| {
+ let handle = thread::Builder::new().name($name).spawn_scoped(s, || {
let mut flag = false;
$p::check($($args, )* &mut flag);
if (flag) {
bad.store(true, Ordering::Relaxed);
}
- });
+ }).unwrap();
handles.push_back(handle);
}
}
@@ -91,7 +103,6 @@ fn main() {
// Checks that need to be done for both the compiler and std libraries.
check!(unit_tests, &src_path);
- check!(unit_tests, &tests_path);
check!(unit_tests, &compiler_path);
check!(unit_tests, &library_path);
@@ -107,10 +118,8 @@ fn main() {
check!(edition, &src_path);
check!(edition, &compiler_path);
check!(edition, &library_path);
- check!(edition, &tests_path);
check!(alphabetical, &src_path);
- check!(alphabetical, &tests_path);
check!(alphabetical, &compiler_path);
check!(alphabetical, &library_path);