@@ -343,7 +343,7 @@ impl<K: DepKind> DepGraphData<K> {
343343 task : fn ( Ctxt , A ) -> R ,
344344 hash_result : Option < fn ( & mut StableHashingContext < ' _ > , & R ) -> Fingerprint > ,
345345 ) -> ( R , DepNodeIndex ) {
346- self . assert_nonexistent_node ( & key, || {
346+ self . assert_nonexistent_node ( key, || {
347347 format ! (
348348 "forcing query with already existing `DepNode`\n \
349349 - query-key: {arg:?}\n \
@@ -353,7 +353,7 @@ impl<K: DepKind> DepGraphData<K> {
353353
354354 let with_deps = |task_deps| K :: with_deps ( task_deps, || task ( cx, arg) ) ;
355355 let ( result, edges) = if cx. dep_context ( ) . is_eval_always ( key. kind ) {
356- ( with_deps ( TaskDepsRef :: EvalAlways ) , smallvec ! [ ] )
356+ ( with_deps ( TaskDepsRef :: EvalAlways ) , smallvec ! [ DepNodeIndex :: FOREVER_RED_NODE ] )
357357 } else {
358358 let task_deps = Lock :: new ( TaskDeps {
359359 #[ cfg( debug_assertions) ]
@@ -643,12 +643,12 @@ impl<K: DepKind> DepGraph<K> {
643643impl < K : DepKind > DepGraphData < K > {
644644 fn assert_nonexistent_node < S : std:: fmt:: Display > (
645645 & self ,
646- _dep_node : & DepNode < K > ,
646+ _dep_node : DepNode < K > ,
647647 _msg : impl FnOnce ( ) -> S ,
648648 ) {
649649 #[ cfg( debug_assertions) ]
650650 if let Some ( seen_dep_nodes) = & self . current . seen_dep_nodes {
651- let seen = seen_dep_nodes. lock ( ) . contains ( _dep_node) ;
651+ let seen = seen_dep_nodes. lock ( ) . contains ( & _dep_node) ;
652652 assert ! ( !seen, "{}" , _msg( ) ) ;
653653 }
654654 }
@@ -760,7 +760,7 @@ impl<K: DepKind> DepGraphData<K> {
760760 // in the previous compilation session too, so we can try to
761761 // mark it as green by recursively marking all of its
762762 // dependencies green.
763- self . try_mark_previous_green ( qcx, prev_index, & dep_node , None )
763+ self . try_mark_previous_green ( qcx, prev_index, None )
764764 . map ( |dep_node_index| ( prev_index, dep_node_index) )
765765 }
766766 }
@@ -771,51 +771,43 @@ impl<K: DepKind> DepGraphData<K> {
771771 & self ,
772772 qcx : Qcx ,
773773 parent_dep_node_index : SerializedDepNodeIndex ,
774- dep_node : & DepNode < K > ,
775774 frame : Option < & MarkFrame < ' _ > > ,
776775 ) -> Option < ( ) > {
777776 let dep_dep_node_color = self . colors . get ( parent_dep_node_index) ;
778- let dep_dep_node = & self . previous . index_to_node ( parent_dep_node_index) ;
777+ let dep_dep_node = || self . previous . index_to_node ( parent_dep_node_index) ;
779778
780779 match dep_dep_node_color {
781780 Some ( DepNodeColor :: Green ( _) ) => {
782781 // This dependency has been marked as green before, we are
783782 // still fine and can continue with checking the other
784783 // dependencies.
785- debug ! ( "dependency {dep_dep_node :?} was immediately green" ) ;
784+ debug ! ( "dependency {:?} was immediately green" , dep_dep_node ( ) ) ;
786785 return Some ( ( ) ) ;
787786 }
788787 Some ( DepNodeColor :: Red ) => {
789788 // We found a dependency the value of which has changed
790789 // compared to the previous compilation session. We cannot
791790 // mark the DepNode as green and also don't need to bother
792791 // with checking any of the other dependencies.
793- debug ! ( "dependency {dep_dep_node :?} was immediately red" ) ;
792+ debug ! ( "dependency {:?} was immediately red" , dep_dep_node ( ) ) ;
794793 return None ;
795794 }
796795 None => { }
797796 }
798797
799- // We don't know the state of this dependency. If it isn't
800- // an eval_always node, let's try to mark it green recursively.
801- if !qcx. dep_context ( ) . is_eval_always ( dep_dep_node. kind ) {
802- debug ! (
803- "state of dependency {:?} ({}) is unknown, trying to mark it green" ,
804- dep_dep_node, dep_dep_node. hash,
805- ) ;
806-
807- let node_index =
808- self . try_mark_previous_green ( qcx, parent_dep_node_index, dep_dep_node, frame) ;
798+ // We don't know the state of this dependency. Let's try to mark it green recursively.
799+ debug ! ( "state of dependency {:?} is unknown, trying to mark it green" , dep_dep_node( ) ) ;
800+ let node_index = self . try_mark_previous_green ( qcx, parent_dep_node_index, frame) ;
809801
810- if node_index. is_some ( ) {
811- debug ! ( "managed to MARK dependency {dep_dep_node:?} as green" , ) ;
812- return Some ( ( ) ) ;
813- }
802+ if node_index. is_some ( ) {
803+ debug ! ( "managed to MARK dependency {:?} as green" , dep_dep_node( ) ) ;
804+ return Some ( ( ) ) ;
814805 }
815806
816807 // We failed to mark it green, so we try to force the query.
808+ let dep_dep_node = dep_dep_node ( ) ;
817809 debug ! ( "trying to force dependency {dep_dep_node:?}" ) ;
818- if !qcx. dep_context ( ) . try_force_from_dep_node ( * dep_dep_node, frame) {
810+ if !qcx. dep_context ( ) . try_force_from_dep_node ( dep_dep_node, frame) {
819811 // The DepNode could not be forced.
820812 debug ! ( "dependency {dep_dep_node:?} could not be forced" ) ;
821813 return None ;
@@ -859,27 +851,21 @@ impl<K: DepKind> DepGraphData<K> {
859851 & self ,
860852 qcx : Qcx ,
861853 prev_dep_node_index : SerializedDepNodeIndex ,
862- dep_node : & DepNode < K > ,
863854 frame : Option < & MarkFrame < ' _ > > ,
864855 ) -> Option < DepNodeIndex > {
865856 let frame = MarkFrame { index : prev_dep_node_index, parent : frame } ;
857+ let dep_node = || self . previous . index_to_node ( prev_dep_node_index) ;
866858
867859 #[ cfg( not( parallel_compiler) ) ]
868- self . assert_nonexistent_node ( dep_node, || {
869- format ! ( "trying to mark existing {dep_node :?} as green" )
860+ self . assert_nonexistent_node ( dep_node ( ) , || {
861+ format ! ( "trying to mark existing {:?} as green" , dep_node ( ) )
870862 } ) ;
871863 #[ cfg( not( parallel_compiler) ) ]
872864 debug_assert ! ( self . colors. get( prev_dep_node_index) . is_none( ) ) ;
873865
874- // We never try to mark eval_always nodes as green
875- debug_assert ! ( !qcx. dep_context( ) . is_eval_always( dep_node. kind) ) ;
876-
877- debug_assert_eq ! ( self . previous. index_to_node( prev_dep_node_index) , * dep_node) ;
878-
879866 let prev_deps = self . previous . edge_targets_from ( prev_dep_node_index) ;
880-
881867 for & dep_dep_node_index in prev_deps {
882- self . try_mark_parent_green ( qcx, dep_dep_node_index, dep_node , Some ( & frame) ) ?;
868+ self . try_mark_parent_green ( qcx, dep_dep_node_index, Some ( & frame) ) ?;
883869 }
884870
885871 // If we got here without hitting a `return` that means that all
@@ -905,8 +891,8 @@ impl<K: DepKind> DepGraphData<K> {
905891 #[ cfg( not( parallel_compiler) ) ]
906892 debug_assert ! (
907893 self . colors. get( prev_dep_node_index) . is_none( ) ,
908- "DepGraph::try_mark_previous_green() - Duplicate DepNodeColor \
909- insertion for { dep_node:?}"
894+ "DepGraph::try_mark_previous_green() - Duplicate DepNodeColor insertion for {:?}" ,
895+ dep_node( )
910896 ) ;
911897
912898 if !side_effects. is_empty ( ) {
@@ -919,7 +905,7 @@ impl<K: DepKind> DepGraphData<K> {
919905 // Multiple threads can all write the same color here
920906 self . colors . insert ( prev_dep_node_index, DepNodeColor :: Green ( dep_node_index) ) ;
921907
922- debug ! ( "successfully marked {dep_node :?} as green" ) ;
908+ debug ! ( "successfully marked {:?} as green" , dep_node ( ) ) ;
923909 Some ( dep_node_index)
924910 }
925911
@@ -966,7 +952,7 @@ impl<K: DepKind> DepGraph<K> {
966952
967953 pub fn assert_nonexistent_node < S : std:: fmt:: Display > (
968954 & self ,
969- dep_node : & DepNode < K > ,
955+ dep_node : DepNode < K > ,
970956 msg : impl FnOnce ( ) -> S ,
971957 ) {
972958 if cfg ! ( debug_assertions)
0 commit comments