From f7d53a96ca9e74f00355951c03384184464ebbc2 Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy@goop.org>
Date: Thu, 18 Jul 2019 01:02:22 -0700
Subject: [PATCH] Emit artifact notifications for dependency files

---
 src/librustc_interface/passes.rs | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs
index bb58d13498996..bb11657d0c40c 100644
--- a/src/librustc_interface/passes.rs
+++ b/src/librustc_interface/passes.rs
@@ -688,12 +688,20 @@ fn write_out_deps(sess: &Session, outputs: &OutputFilenames, out_filenames: &[Pa
         Ok(())
     })();
 
-    if let Err(e) = result {
-        sess.fatal(&format!(
-            "error writing dependencies to `{}`: {}",
-            deps_filename.display(),
-            e
-        ));
+    match result {
+        Ok(_) => {
+            if sess.opts.debugging_opts.emit_artifact_notifications {
+                 sess.parse_sess.span_diagnostic
+                    .emit_artifact_notification(&deps_filename, "dep-info");
+            }
+        },
+        Err(e) => {
+            sess.fatal(&format!(
+                "error writing dependencies to `{}`: {}",
+                deps_filename.display(),
+                e
+            ))
+        }
     }
 }