@@ -1065,7 +1065,7 @@ pub(super) struct CurrentDepGraph<K: DepKind> {
10651065 /// This is used to verify that fingerprints do not change between the creation of a node
10661066 /// and its recomputation.
10671067 #[ cfg( debug_assertions) ]
1068- fingerprints : Lock < FxHashMap < DepNode < K > , Fingerprint > > ,
1068+ fingerprints : Lock < IndexVec < DepNodeIndex , Option < Fingerprint > > > ,
10691069
10701070 /// Used to trap when a specific edge is added to the graph.
10711071 /// This is used for debug purposes and is only active with `debug_assertions`.
@@ -1151,7 +1151,7 @@ impl<K: DepKind> CurrentDepGraph<K> {
11511151 #[ cfg( debug_assertions) ]
11521152 forbidden_edge,
11531153 #[ cfg( debug_assertions) ]
1154- fingerprints : Lock :: new ( Default :: default ( ) ) ,
1154+ fingerprints : Lock :: new ( IndexVec :: from_elem_n ( None , new_node_count_estimate ) ) ,
11551155 total_read_count : AtomicU64 :: new ( 0 ) ,
11561156 total_duplicate_read_count : AtomicU64 :: new ( 0 ) ,
11571157 node_intern_event_id,
@@ -1163,14 +1163,8 @@ impl<K: DepKind> CurrentDepGraph<K> {
11631163 if let Some ( forbidden_edge) = & self . forbidden_edge {
11641164 forbidden_edge. index_to_node . lock ( ) . insert ( dep_node_index, key) ;
11651165 }
1166- match self . fingerprints . lock ( ) . entry ( key) {
1167- Entry :: Vacant ( v) => {
1168- v. insert ( fingerprint) ;
1169- }
1170- Entry :: Occupied ( o) => {
1171- assert_eq ! ( * o. get( ) , fingerprint, "Unstable fingerprints for {:?}" , key) ;
1172- }
1173- }
1166+ let previous = * self . fingerprints . lock ( ) . get_or_insert_with ( dep_node_index, || fingerprint) ;
1167+ assert_eq ! ( previous, fingerprint, "Unstable fingerprints for {:?}" , key) ;
11741168 }
11751169
11761170 /// Writes the node to the current dep-graph and allocates a `DepNodeIndex` for it.
0 commit comments