@@ -1065,7 +1065,7 @@ pub(super) struct CurrentDepGraph<K: DepKind> {
1065
1065
/// This is used to verify that fingerprints do not change between the creation of a node
1066
1066
/// and its recomputation.
1067
1067
#[ cfg( debug_assertions) ]
1068
- fingerprints : Lock < FxHashMap < DepNode < K > , Fingerprint > > ,
1068
+ fingerprints : Lock < IndexVec < DepNodeIndex , Option < Fingerprint > > > ,
1069
1069
1070
1070
/// Used to trap when a specific edge is added to the graph.
1071
1071
/// This is used for debug purposes and is only active with `debug_assertions`.
@@ -1151,7 +1151,7 @@ impl<K: DepKind> CurrentDepGraph<K> {
1151
1151
#[ cfg( debug_assertions) ]
1152
1152
forbidden_edge,
1153
1153
#[ cfg( debug_assertions) ]
1154
- fingerprints : Lock :: new ( Default :: default ( ) ) ,
1154
+ fingerprints : Lock :: new ( IndexVec :: from_elem_n ( None , new_node_count_estimate ) ) ,
1155
1155
total_read_count : AtomicU64 :: new ( 0 ) ,
1156
1156
total_duplicate_read_count : AtomicU64 :: new ( 0 ) ,
1157
1157
node_intern_event_id,
@@ -1163,14 +1163,8 @@ impl<K: DepKind> CurrentDepGraph<K> {
1163
1163
if let Some ( forbidden_edge) = & self . forbidden_edge {
1164
1164
forbidden_edge. index_to_node . lock ( ) . insert ( dep_node_index, key) ;
1165
1165
}
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) ;
1174
1168
}
1175
1169
1176
1170
/// Writes the node to the current dep-graph and allocates a `DepNodeIndex` for it.
0 commit comments