@@ -1053,7 +1053,7 @@ pub(super) struct CurrentDepGraph<K: DepKind> {
10531053 /// This is used to verify that fingerprints do not change between the creation of a node
10541054 /// and its recomputation.
10551055 #[ cfg( debug_assertions) ]
1056- fingerprints : Lock < FxHashMap < DepNode < K > , Fingerprint > > ,
1056+ fingerprints : Lock < IndexVec < DepNodeIndex , Option < Fingerprint > > > ,
10571057
10581058 /// Used to trap when a specific edge is added to the graph.
10591059 /// This is used for debug purposes and is only active with `debug_assertions`.
@@ -1139,7 +1139,7 @@ impl<K: DepKind> CurrentDepGraph<K> {
11391139 #[ cfg( debug_assertions) ]
11401140 forbidden_edge,
11411141 #[ cfg( debug_assertions) ]
1142- fingerprints : Lock :: new ( Default :: default ( ) ) ,
1142+ fingerprints : Lock :: new ( IndexVec :: from_elem_n ( None , new_node_count_estimate ) ) ,
11431143 total_read_count : AtomicU64 :: new ( 0 ) ,
11441144 total_duplicate_read_count : AtomicU64 :: new ( 0 ) ,
11451145 node_intern_event_id,
@@ -1151,14 +1151,8 @@ impl<K: DepKind> CurrentDepGraph<K> {
11511151 if let Some ( forbidden_edge) = & self . forbidden_edge {
11521152 forbidden_edge. index_to_node . lock ( ) . insert ( dep_node_index, key) ;
11531153 }
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) ;
11621156 }
11631157
11641158 /// Writes the node to the current dep-graph and allocates a `DepNodeIndex` for it.
0 commit comments