about summary refs log tree commit diff
path: root/src/librustc_driver
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2018-02-13 13:37:32 +0100
committerMichael Woerister <michaelwoerister@posteo>2018-02-13 13:37:32 +0100
commit580dd42cfaefcb3189eab786224403ffe45bd37f (patch)
treeffb0508e16a3f2173db891fc2f453b8fc635a661 /src/librustc_driver
parent4d2d3fc5dadf894a8ad709a5860a549f2c0b1032 (diff)
incr.comp.: Run cache directory garbage collection before loading dep-graph.
Diffstat (limited to 'src/librustc_driver')
-rw-r--r--src/librustc_driver/driver.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs
index f344624666a..b8a1fe99105 100644
--- a/src/librustc_driver/driver.rs
+++ b/src/librustc_driver/driver.rs
@@ -660,6 +660,15 @@ pub fn phase_2_configure_and_expand_inner<'a, F>(sess: &'a Session,
         disambiguator,
     );
 
+    if sess.opts.incremental.is_some() {
+        time(time_passes, "garbage collect incremental cache directory", || {
+            if let Err(e) = rustc_incremental::garbage_collect_session_directories(sess) {
+                warn!("Error while trying to garbage collect incremental \
+                       compilation cache directory: {}", e);
+            }
+        });
+    }
+
     // If necessary, compute the dependency graph (in the background).
     let future_dep_graph = if sess.opts.build_dep_graph() {
         Some(rustc_incremental::load_dep_graph(sess, time_passes))