]> git.lizzy.rs Git - rust.git/commitdiff
rustc: Use `create_dir_racy` in save analysis
authorAlex Crichton <alex@alexcrichton.com>
Tue, 13 Dec 2016 17:12:39 +0000 (09:12 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 13 Dec 2016 17:17:28 +0000 (09:17 -0800)
The OSX bots failed last night due a race condition in save analysis where
concurrent calls to `fs::create_dir_all` conflicted with one another. This
replaces the relevant function call with `fs::create_dir_racy` which is defined
internally to the compiler.

src/librustc_save_analysis/lib.rs

index 0c910240b60f0765b2349ab98ab999ceb80a43ea..862345fd46eb6ce743ab50bfa07f398b993adaeb 100644 (file)
@@ -48,7 +48,7 @@
 use rustc::ty::{self, TyCtxt};
 
 use std::env;
-use std::fs::{self, File};
+use std::fs::File;
 use std::path::{Path, PathBuf};
 
 use syntax::ast::{self, NodeId, PatKind, Attribute, CRATE_NODE_ID};
@@ -832,7 +832,7 @@ pub fn process_crate<'l, 'tcx>(tcx: TyCtxt<'l, 'tcx, 'tcx>,
         },
     };
 
-    if let Err(e) = fs::create_dir_all(&root_path) {
+    if let Err(e) = rustc::util::fs::create_dir_racy(&root_path) {
         tcx.sess.err(&format!("Could not create directory {}: {}",
                               root_path.display(),
                               e));