@@ -13,7 +13,7 @@ use std::path::PathBuf;
13
13
use std:: process;
14
14
use std:: str:: FromStr ;
15
15
use std:: sync:: atomic:: { AtomicBool , Ordering } ;
16
- use std:: thread:: { scope, ScopedJoinHandle } ;
16
+ use std:: thread:: { self , scope, ScopedJoinHandle } ;
17
17
18
18
fn main ( ) {
19
19
let root_path: PathBuf = env:: args_os ( ) . nth ( 1 ) . expect ( "need path to root of repo" ) . into ( ) ;
@@ -55,16 +55,28 @@ fn main() {
55
55
VecDeque :: with_capacity ( concurrency. get ( ) ) ;
56
56
57
57
macro_rules! check {
58
- ( $p: ident $( , $args: expr) * ) => {
58
+ ( $p: ident) => {
59
+ check!( @ $p, name=format!( "{}" , stringify!( $p) ) ) ;
60
+ } ;
61
+ ( $p: ident, $path: expr $( , $args: expr) * ) => {
62
+ let shortened = $path. strip_prefix( & root_path) . unwrap( ) ;
63
+ let name = if shortened == std:: path:: Path :: new( "" ) {
64
+ format!( "{} (.)" , stringify!( $p) )
65
+ } else {
66
+ format!( "{} ({})" , stringify!( $p) , shortened. display( ) )
67
+ } ;
68
+ check!( @ $p, name=name, $path $( , $args) * ) ;
69
+ } ;
70
+ ( @ $p: ident, name=$name: expr $( , $args: expr) * ) => {
59
71
drain_handles( & mut handles) ;
60
72
61
- let handle = s . spawn ( || {
73
+ let handle = thread :: Builder :: new ( ) . name ( $name ) . spawn_scoped ( s , || {
62
74
let mut flag = false ;
63
75
$p:: check( $( $args, ) * & mut flag) ;
64
76
if ( flag) {
65
77
bad. store( true , Ordering :: Relaxed ) ;
66
78
}
67
- } ) ;
79
+ } ) . unwrap ( ) ;
68
80
handles. push_back( handle) ;
69
81
}
70
82
}
0 commit comments