]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/dep_graph/graph.rs
Auto merge of #58302 - SimonSapin:tryfrom, r=alexcrichton
[rust.git] / src / librustc / dep_graph / graph.rs
index 59ec459de964160d70b9161ca67dd17a8ae234b5..8a2f79e6793c0c8295385f6546fa72aefaba9ee7 100644 (file)
@@ -1,4 +1,4 @@
-use crate::errors::{Diagnostic, DiagnosticBuilder};
+use errors::{Diagnostic, DiagnosticBuilder};
 use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use rustc_data_structures::indexed_vec::{Idx, IndexVec};
@@ -292,17 +292,28 @@ fn with_task_impl<'a, C, A, R>(
                 task_deps.map(|lock| lock.into_inner()),
             );
 
+            let print_status = cfg!(debug_assertions) && hcx.sess().opts.debugging_opts.dep_tasks;
+
             // Determine the color of the new DepNode.
             if let Some(prev_index) = data.previous.node_to_index_opt(&key) {
                 let prev_fingerprint = data.previous.fingerprint_by_index(prev_index);
 
                 let color = if let Some(current_fingerprint) = current_fingerprint {
                     if current_fingerprint == prev_fingerprint {
+                        if print_status {
+                            eprintln!("[task::green] {:?}", key);
+                        }
                         DepNodeColor::Green(dep_node_index)
                     } else {
+                        if print_status {
+                            eprintln!("[task::red] {:?}", key);
+                        }
                         DepNodeColor::Red
                     }
                 } else {
+                    if print_status {
+                        eprintln!("[task::unknown] {:?}", key);
+                    }
                     // Mark the node as Red if we can't hash the result
                     DepNodeColor::Red
                 };
@@ -312,6 +323,10 @@ fn with_task_impl<'a, C, A, R>(
                             insertion for {:?}", key);
 
                 data.colors.insert(prev_index, color);
+            } else {
+                if print_status {
+                    eprintln!("[task::new] {:?}", key);
+                }
             }
 
             (result, dep_node_index)