1
- use rustc_data_structures:: fx:: FxHashMap ;
1
+ use rustc_data_structures:: fx:: FxIndexMap ;
2
2
use rustc_data_structures:: graph:: WithNumNodes ;
3
3
use rustc_index:: bit_set:: BitSet ;
4
4
use rustc_index:: IndexVec ;
@@ -47,7 +47,10 @@ pub(super) struct CoverageCounters {
47
47
bcb_counters : IndexVec < BasicCoverageBlock , Option < BcbCounter > > ,
48
48
/// Coverage counters/expressions that are associated with the control-flow
49
49
/// edge between two BCBs.
50
- bcb_edge_counters : FxHashMap < ( BasicCoverageBlock , BasicCoverageBlock ) , BcbCounter > ,
50
+ ///
51
+ /// The iteration order of this map can affect the precise contents of MIR,
52
+ /// so we use `FxIndexMap` to avoid query stability hazards.
53
+ bcb_edge_counters : FxIndexMap < ( BasicCoverageBlock , BasicCoverageBlock ) , BcbCounter > ,
51
54
/// Tracks which BCBs have a counter associated with some incoming edge.
52
55
/// Only used by assertions, to verify that BCBs with incoming edge
53
56
/// counters do not have their own physical counters (expressions are allowed).
@@ -64,7 +67,7 @@ impl CoverageCounters {
64
67
Self {
65
68
next_counter_id : CounterId :: START ,
66
69
bcb_counters : IndexVec :: from_elem_n ( None , num_bcbs) ,
67
- bcb_edge_counters : FxHashMap :: default ( ) ,
70
+ bcb_edge_counters : FxIndexMap :: default ( ) ,
68
71
bcb_has_incoming_edge_counters : BitSet :: new_empty ( num_bcbs) ,
69
72
expressions : IndexVec :: new ( ) ,
70
73
}
0 commit comments