@@ -876,27 +876,34 @@ impl<D: Deps> DepGraphData<D> {
876
876
frame : Option < & MarkFrame < ' _ > > ,
877
877
) -> Option < ( ) > {
878
878
let dep_dep_node_color = self . colors . get ( parent_dep_node_index) ;
879
- let dep_dep_node = & self . previous . index_to_node ( parent_dep_node_index) ;
879
+
880
+ let get_dep_dep_node = || self . previous . index_to_node ( parent_dep_node_index) ;
880
881
881
882
match dep_dep_node_color {
882
883
Some ( DepNodeColor :: Green ( _) ) => {
883
884
// This dependency has been marked as green before, we are
884
885
// still fine and can continue with checking the other
885
886
// dependencies.
886
- debug ! ( "dependency {dep_dep_node:?} was immediately green" ) ;
887
+ //
888
+ // This path is extremely hot. We don't want to get the
889
+ // `dep_dep_node` unless it's necessary. Hence the
890
+ // `get_dep_dep_node` closure.
891
+ debug ! ( "dependency {:?} was immediately green" , get_dep_dep_node( ) ) ;
887
892
return Some ( ( ) ) ;
888
893
}
889
894
Some ( DepNodeColor :: Red ) => {
890
895
// We found a dependency the value of which has changed
891
896
// compared to the previous compilation session. We cannot
892
897
// mark the DepNode as green and also don't need to bother
893
898
// with checking any of the other dependencies.
894
- debug ! ( "dependency {dep_dep_node :?} was immediately red" ) ;
899
+ debug ! ( "dependency {:?} was immediately red" , get_dep_dep_node ( ) ) ;
895
900
return None ;
896
901
}
897
902
None => { }
898
903
}
899
904
905
+ let dep_dep_node = & get_dep_dep_node ( ) ;
906
+
900
907
// We don't know the state of this dependency. If it isn't
901
908
// an eval_always node, let's try to mark it green recursively.
902
909
if !qcx. dep_context ( ) . is_eval_always ( dep_dep_node. kind ) {
0 commit comments