@@ -11,7 +11,7 @@ use crate::build::ForGuard::{self, OutsideGuard, RefWithinGuard};
11
11
use crate :: build:: { BlockAnd , BlockAndExtension , Builder } ;
12
12
use crate :: build:: { GuardFrame , GuardFrameLocal , LocalsForNode } ;
13
13
use rustc_data_structures:: {
14
- fx:: { FxHashSet , FxIndexMap } ,
14
+ fx:: { FxIndexMap , FxIndexSet } ,
15
15
stack:: ensure_sufficient_stack,
16
16
} ;
17
17
use rustc_hir:: HirId ;
@@ -264,7 +264,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
264
264
// The set of places that we are creating fake borrows of. If there are
265
265
// no match guards then we don't need any fake borrows, so don't track
266
266
// them.
267
- let mut fake_borrows = match_has_guard. then ( FxHashSet :: default) ;
267
+ let mut fake_borrows = match_has_guard. then ( FxIndexSet :: default) ;
268
268
269
269
let mut otherwise = None ;
270
270
@@ -1053,7 +1053,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1053
1053
start_block : BasicBlock ,
1054
1054
otherwise_block : & mut Option < BasicBlock > ,
1055
1055
candidates : & mut [ & mut Candidate < ' pat , ' tcx > ] ,
1056
- fake_borrows : & mut Option < FxHashSet < Place < ' tcx > > > ,
1056
+ fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
1057
1057
) {
1058
1058
debug ! (
1059
1059
"matched_candidate(span={:?}, candidates={:?}, start_block={:?}, otherwise_block={:?})" ,
@@ -1105,7 +1105,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1105
1105
start_block : BasicBlock ,
1106
1106
otherwise_block : & mut Option < BasicBlock > ,
1107
1107
candidates : & mut [ & mut Candidate < ' _ , ' tcx > ] ,
1108
- fake_borrows : & mut Option < FxHashSet < Place < ' tcx > > > ,
1108
+ fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
1109
1109
) {
1110
1110
// The candidates are sorted by priority. Check to see whether the
1111
1111
// higher priority candidates (and hence at the front of the slice)
@@ -1184,7 +1184,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1184
1184
& mut self ,
1185
1185
matched_candidates : & mut [ & mut Candidate < ' _ , ' tcx > ] ,
1186
1186
start_block : BasicBlock ,
1187
- fake_borrows : & mut Option < FxHashSet < Place < ' tcx > > > ,
1187
+ fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
1188
1188
) -> Option < BasicBlock > {
1189
1189
debug_assert ! (
1190
1190
!matched_candidates. is_empty( ) ,
@@ -1322,7 +1322,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1322
1322
candidates : & mut [ & mut Candidate < ' _ , ' tcx > ] ,
1323
1323
block : BasicBlock ,
1324
1324
otherwise_block : & mut Option < BasicBlock > ,
1325
- fake_borrows : & mut Option < FxHashSet < Place < ' tcx > > > ,
1325
+ fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
1326
1326
) {
1327
1327
let ( first_candidate, remaining_candidates) = candidates. split_first_mut ( ) . unwrap ( ) ;
1328
1328
@@ -1385,7 +1385,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1385
1385
pats : & ' pat [ Pat < ' tcx > ] ,
1386
1386
or_span : Span ,
1387
1387
place : PlaceBuilder < ' tcx > ,
1388
- fake_borrows : & mut Option < FxHashSet < Place < ' tcx > > > ,
1388
+ fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
1389
1389
) {
1390
1390
debug ! ( "test_or_pattern:\n candidate={:#?}\n pats={:#?}" , candidate, pats) ;
1391
1391
let mut or_candidates: Vec < _ > = pats
@@ -1572,7 +1572,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1572
1572
mut candidates : & ' b mut [ & ' c mut Candidate < ' pat , ' tcx > ] ,
1573
1573
block : BasicBlock ,
1574
1574
otherwise_block : & mut Option < BasicBlock > ,
1575
- fake_borrows : & mut Option < FxHashSet < Place < ' tcx > > > ,
1575
+ fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
1576
1576
) {
1577
1577
// extract the match-pair from the highest priority candidate
1578
1578
let match_pair = & candidates. first ( ) . unwrap ( ) . match_pairs [ 0 ] ;
@@ -1715,7 +1715,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1715
1715
/// by a MIR pass run after borrow checking.
1716
1716
fn calculate_fake_borrows < ' b > (
1717
1717
& mut self ,
1718
- fake_borrows : & ' b FxHashSet < Place < ' tcx > > ,
1718
+ fake_borrows : & ' b FxIndexSet < Place < ' tcx > > ,
1719
1719
temp_span : Span ,
1720
1720
) -> Vec < ( Place < ' tcx > , Local ) > {
1721
1721
let tcx = self . tcx ;
@@ -1741,8 +1741,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1741
1741
all_fake_borrows. push ( place. as_ref ( ) ) ;
1742
1742
}
1743
1743
1744
- // Deduplicate and ensure a deterministic order.
1745
- all_fake_borrows. sort ( ) ;
1746
1744
all_fake_borrows. dedup ( ) ;
1747
1745
1748
1746
debug ! ( "add_fake_borrows all_fake_borrows = {:?}" , all_fake_borrows) ;
0 commit comments