1- use rustc_data_structures:: fx:: FxHashMap ;
1+ use rustc_data_structures:: fx:: FxIndexMap ;
22use rustc_data_structures:: graph:: WithNumNodes ;
33use rustc_index:: bit_set:: BitSet ;
44use rustc_index:: IndexVec ;
@@ -47,7 +47,10 @@ pub(super) struct CoverageCounters {
4747 bcb_counters : IndexVec < BasicCoverageBlock , Option < BcbCounter > > ,
4848 /// Coverage counters/expressions that are associated with the control-flow
4949 /// 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 > ,
5154 /// Tracks which BCBs have a counter associated with some incoming edge.
5255 /// Only used by assertions, to verify that BCBs with incoming edge
5356 /// counters do not have their own physical counters (expressions are allowed).
@@ -64,7 +67,7 @@ impl CoverageCounters {
6467 Self {
6568 next_counter_id : CounterId :: START ,
6669 bcb_counters : IndexVec :: from_elem_n ( None , num_bcbs) ,
67- bcb_edge_counters : FxHashMap :: default ( ) ,
70+ bcb_edge_counters : FxIndexMap :: default ( ) ,
6871 bcb_has_incoming_edge_counters : BitSet :: new_empty ( num_bcbs) ,
6972 expressions : IndexVec :: new ( ) ,
7073 }
0 commit comments