@@ -1053,7 +1053,7 @@ pub(super) struct CurrentDepGraph<K: DepKind> {
1053
1053
/// This is used to verify that fingerprints do not change between the creation of a node
1054
1054
/// and its recomputation.
1055
1055
#[ cfg( debug_assertions) ]
1056
- fingerprints : Lock < FxHashMap < DepNode < K > , Fingerprint > > ,
1056
+ fingerprints : Lock < IndexVec < DepNodeIndex , Option < Fingerprint > > > ,
1057
1057
1058
1058
/// Used to trap when a specific edge is added to the graph.
1059
1059
/// This is used for debug purposes and is only active with `debug_assertions`.
@@ -1139,7 +1139,7 @@ impl<K: DepKind> CurrentDepGraph<K> {
1139
1139
#[ cfg( debug_assertions) ]
1140
1140
forbidden_edge,
1141
1141
#[ cfg( debug_assertions) ]
1142
- fingerprints : Lock :: new ( Default :: default ( ) ) ,
1142
+ fingerprints : Lock :: new ( IndexVec :: from_elem_n ( None , new_node_count_estimate ) ) ,
1143
1143
total_read_count : AtomicU64 :: new ( 0 ) ,
1144
1144
total_duplicate_read_count : AtomicU64 :: new ( 0 ) ,
1145
1145
node_intern_event_id,
@@ -1151,14 +1151,8 @@ impl<K: DepKind> CurrentDepGraph<K> {
1151
1151
if let Some ( forbidden_edge) = & self . forbidden_edge {
1152
1152
forbidden_edge. index_to_node . lock ( ) . insert ( dep_node_index, key) ;
1153
1153
}
1154
- match self . fingerprints . lock ( ) . entry ( key) {
1155
- Entry :: Vacant ( v) => {
1156
- v. insert ( fingerprint) ;
1157
- }
1158
- Entry :: Occupied ( o) => {
1159
- assert_eq ! ( * o. get( ) , fingerprint, "Unstable fingerprints for {:?}" , key) ;
1160
- }
1161
- }
1154
+ let previous = * self . fingerprints . lock ( ) . get_or_insert_with ( dep_node_index, || fingerprint) ;
1155
+ assert_eq ! ( previous, fingerprint, "Unstable fingerprints for {:?}" , key) ;
1162
1156
}
1163
1157
1164
1158
/// Writes the node to the current dep-graph and allocates a `DepNodeIndex` for it.
0 commit comments