@@ -376,25 +376,8 @@ impl<D: Deps> DepGraphData<D> {
376
376
} ;
377
377
378
378
let dcx = cx. dep_context ( ) ;
379
- let hashing_timer = dcx. profiler ( ) . incr_result_hashing ( ) ;
380
- let current_fingerprint =
381
- hash_result. map ( |f| dcx. with_stable_hashing_context ( |mut hcx| f ( & mut hcx, & result) ) ) ;
382
-
383
- // Intern the new `DepNode`.
384
- let ( dep_node_index, prev_and_color) =
385
- self . current . intern_node ( & self . previous , key, edges, current_fingerprint) ;
386
-
387
- hashing_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
388
-
389
- if let Some ( ( prev_index, color) ) = prev_and_color {
390
- debug_assert ! (
391
- self . colors. get( prev_index) . is_none( ) ,
392
- "DepGraph::with_task() - Duplicate DepNodeColor \
393
- insertion for {key:?}"
394
- ) ;
395
-
396
- self . colors . insert ( prev_index, color) ;
397
- }
379
+ let dep_node_index =
380
+ self . hash_result_and_intern_node ( dcx, key, edges, & result, hash_result) ;
398
381
399
382
( result, dep_node_index)
400
383
}
@@ -462,6 +445,38 @@ impl<D: Deps> DepGraphData<D> {
462
445
463
446
( result, dep_node_index)
464
447
}
448
+
449
+ /// Intern the new `DepNode` with the dependencies up-to-now.
450
+ fn hash_result_and_intern_node < Ctxt : DepContext < Deps = D > , R > (
451
+ & self ,
452
+ cx : & Ctxt ,
453
+ node : DepNode ,
454
+ edges : EdgesVec ,
455
+ result : & R ,
456
+ hash_result : Option < fn ( & mut StableHashingContext < ' _ > , & R ) -> Fingerprint > ,
457
+ ) -> DepNodeIndex {
458
+ let hashing_timer = cx. profiler ( ) . incr_result_hashing ( ) ;
459
+ let current_fingerprint = hash_result. map ( |hash_result| {
460
+ cx. with_stable_hashing_context ( |mut hcx| hash_result ( & mut hcx, result) )
461
+ } ) ;
462
+
463
+ // Intern the new `DepNode` with the dependencies up-to-now.
464
+ let ( dep_node_index, prev_and_color) =
465
+ self . current . intern_node ( & self . previous , node, edges, current_fingerprint) ;
466
+
467
+ hashing_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
468
+
469
+ if let Some ( ( prev_index, color) ) = prev_and_color {
470
+ debug_assert ! (
471
+ self . colors. get( prev_index) . is_none( ) ,
472
+ "DepGraph::with_task() - Duplicate DepNodeColor insertion for {node:?}" ,
473
+ ) ;
474
+
475
+ self . colors . insert ( prev_index, color) ;
476
+ }
477
+
478
+ dep_node_index
479
+ }
465
480
}
466
481
467
482
impl < D : Deps > DepGraph < D > {
@@ -536,11 +551,10 @@ impl<D: Deps> DepGraph<D> {
536
551
/// FIXME: If the code is changed enough for this node to be marked before requiring the
537
552
/// caller's node, we suppose that those changes will be enough to mark this node red and
538
553
/// force a recomputation using the "normal" way.
539
- pub fn with_feed_task < Ctxt : DepContext < Deps = D > , A : Debug , R : Debug > (
554
+ pub fn with_feed_task < Ctxt : DepContext < Deps = D > , R : Debug > (
540
555
& self ,
541
556
node : DepNode ,
542
557
cx : Ctxt ,
543
- key : A ,
544
558
result : & R ,
545
559
hash_result : Option < fn ( & mut StableHashingContext < ' _ > , & R ) -> Fingerprint > ,
546
560
) -> DepNodeIndex {
@@ -588,27 +602,7 @@ impl<D: Deps> DepGraph<D> {
588
602
}
589
603
} ) ;
590
604
591
- let hashing_timer = cx. profiler ( ) . incr_result_hashing ( ) ;
592
- let current_fingerprint = hash_result. map ( |hash_result| {
593
- cx. with_stable_hashing_context ( |mut hcx| hash_result ( & mut hcx, result) )
594
- } ) ;
595
-
596
- // Intern the new `DepNode` with the dependencies up-to-now.
597
- let ( dep_node_index, prev_and_color) =
598
- data. current . intern_node ( & data. previous , node, edges, current_fingerprint) ;
599
-
600
- hashing_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
601
-
602
- if let Some ( ( prev_index, color) ) = prev_and_color {
603
- debug_assert ! (
604
- data. colors. get( prev_index) . is_none( ) ,
605
- "DepGraph::with_task() - Duplicate DepNodeColor insertion for {key:?}" ,
606
- ) ;
607
-
608
- data. colors . insert ( prev_index, color) ;
609
- }
610
-
611
- dep_node_index
605
+ data. hash_result_and_intern_node ( & cx, node, edges, result, hash_result)
612
606
} else {
613
607
// Incremental compilation is turned off. We just execute the task
614
608
// without tracking. We still provide a dep-node index that uniquely
0 commit comments