@@ -25,7 +25,7 @@ use util::logv;
2525use std:: collections:: HashSet ;
2626use std:: env;
2727use std:: fmt;
28- use std:: fs:: { self , File } ;
28+ use std:: fs:: { self , File , create_dir_all } ;
2929use std:: io:: prelude:: * ;
3030use std:: io:: { self , BufReader } ;
3131use std:: path:: { Path , PathBuf } ;
@@ -395,7 +395,7 @@ actual:\n\
395395
396396 let out_dir = self . output_base_name ( ) . with_extension ( "pretty-out" ) ;
397397 let _ = fs:: remove_dir_all ( & out_dir) ;
398- self . create_dir_racy ( & out_dir) ;
398+ create_dir_all ( & out_dir) . unwrap ( ) ;
399399
400400 // FIXME (#9639): This needs to handle non-utf8 paths
401401 let mut args = vec ! [ "-" . to_owned( ) ,
@@ -1269,7 +1269,7 @@ actual:\n\
12691269
12701270 fn compose_and_run_compiler ( & self , args : ProcArgs , input : Option < String > ) -> ProcRes {
12711271 if !self . props . aux_builds . is_empty ( ) {
1272- self . create_dir_racy ( & self . aux_output_dir_name ( ) ) ;
1272+ create_dir_all ( & self . aux_output_dir_name ( ) ) . unwrap ( ) ;
12731273 }
12741274
12751275 let aux_dir = self . aux_output_dir_name ( ) ;
@@ -1340,22 +1340,6 @@ actual:\n\
13401340 input)
13411341 }
13421342
1343- // Like std::fs::create_dir_all, except handles concurrent calls among multiple
1344- // threads or processes.
1345- fn create_dir_racy ( & self , path : & Path ) {
1346- match fs:: create_dir ( path) {
1347- Ok ( ( ) ) => return ,
1348- Err ( ref e) if e. kind ( ) == io:: ErrorKind :: AlreadyExists => return ,
1349- Err ( ref e) if e. kind ( ) == io:: ErrorKind :: NotFound => { }
1350- Err ( e) => panic ! ( "failed to create dir {:?}: {}" , path, e) ,
1351- }
1352- self . create_dir_racy ( path. parent ( ) . unwrap ( ) ) ;
1353- match fs:: create_dir ( path) {
1354- Ok ( ( ) ) => { }
1355- Err ( ref e) if e. kind ( ) == io:: ErrorKind :: AlreadyExists => { }
1356- Err ( e) => panic ! ( "failed to create dir {:?}: {}" , path, e) ,
1357- }
1358- }
13591343
13601344 fn compose_and_run ( & self ,
13611345 ProcArgs { args, prog } : ProcArgs ,
@@ -1435,7 +1419,7 @@ actual:\n\
14351419
14361420
14371421 let mir_dump_dir = self . get_mir_dump_dir ( ) ;
1438- self . create_dir_racy ( mir_dump_dir. as_path ( ) ) ;
1422+ create_dir_all ( mir_dump_dir. as_path ( ) ) . unwrap ( ) ;
14391423 let mut dir_opt = "dump-mir-dir=" . to_string ( ) ;
14401424 dir_opt. push_str ( mir_dump_dir. to_str ( ) . unwrap ( ) ) ;
14411425 debug ! ( "dir_opt: {:?}" , dir_opt) ;
@@ -1923,7 +1907,7 @@ actual:\n\
19231907
19241908 let out_dir = self . output_base_name ( ) ;
19251909 let _ = fs:: remove_dir_all ( & out_dir) ;
1926- self . create_dir_racy ( & out_dir) ;
1910+ create_dir_all ( & out_dir) . unwrap ( ) ;
19271911
19281912 let proc_res = self . document ( & out_dir) ;
19291913 if !proc_res. status . success ( ) {
@@ -2299,7 +2283,7 @@ actual:\n\
22992283 if tmpdir. exists ( ) {
23002284 self . aggressive_rm_rf ( & tmpdir) . unwrap ( ) ;
23012285 }
2302- self . create_dir_racy ( & tmpdir) ;
2286+ create_dir_all ( & tmpdir) . unwrap ( ) ;
23032287
23042288 let host = & self . config . host ;
23052289 let make = if host. contains ( "bitrig" ) || host. contains ( "dragonfly" ) ||
0 commit comments