@@ -11,7 +11,7 @@ use crate::build::ForGuard::{self, OutsideGuard, RefWithinGuard};
1111use crate :: build:: { BlockAnd , BlockAndExtension , Builder } ;
1212use crate :: build:: { GuardFrame , GuardFrameLocal , LocalsForNode } ;
1313use rustc_data_structures:: {
14- fx:: { FxHashSet , FxIndexMap } ,
14+ fx:: { FxIndexMap , FxIndexSet } ,
1515 stack:: ensure_sufficient_stack,
1616} ;
1717use rustc_hir:: HirId ;
@@ -264,7 +264,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
264264 // The set of places that we are creating fake borrows of. If there are
265265 // no match guards then we don't need any fake borrows, so don't track
266266 // them.
267- let mut fake_borrows = match_has_guard. then ( FxHashSet :: default) ;
267+ let mut fake_borrows = match_has_guard. then ( FxIndexSet :: default) ;
268268
269269 let mut otherwise = None ;
270270
@@ -1053,7 +1053,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
10531053 start_block : BasicBlock ,
10541054 otherwise_block : & mut Option < BasicBlock > ,
10551055 candidates : & mut [ & mut Candidate < ' pat , ' tcx > ] ,
1056- fake_borrows : & mut Option < FxHashSet < Place < ' tcx > > > ,
1056+ fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
10571057 ) {
10581058 debug ! (
10591059 "matched_candidate(span={:?}, candidates={:?}, start_block={:?}, otherwise_block={:?})" ,
@@ -1105,7 +1105,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
11051105 start_block : BasicBlock ,
11061106 otherwise_block : & mut Option < BasicBlock > ,
11071107 candidates : & mut [ & mut Candidate < ' _ , ' tcx > ] ,
1108- fake_borrows : & mut Option < FxHashSet < Place < ' tcx > > > ,
1108+ fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
11091109 ) {
11101110 // The candidates are sorted by priority. Check to see whether the
11111111 // higher priority candidates (and hence at the front of the slice)
@@ -1184,7 +1184,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
11841184 & mut self ,
11851185 matched_candidates : & mut [ & mut Candidate < ' _ , ' tcx > ] ,
11861186 start_block : BasicBlock ,
1187- fake_borrows : & mut Option < FxHashSet < Place < ' tcx > > > ,
1187+ fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
11881188 ) -> Option < BasicBlock > {
11891189 debug_assert ! (
11901190 !matched_candidates. is_empty( ) ,
@@ -1322,7 +1322,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
13221322 candidates : & mut [ & mut Candidate < ' _ , ' tcx > ] ,
13231323 block : BasicBlock ,
13241324 otherwise_block : & mut Option < BasicBlock > ,
1325- fake_borrows : & mut Option < FxHashSet < Place < ' tcx > > > ,
1325+ fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
13261326 ) {
13271327 let ( first_candidate, remaining_candidates) = candidates. split_first_mut ( ) . unwrap ( ) ;
13281328
@@ -1385,7 +1385,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
13851385 pats : & ' pat [ Pat < ' tcx > ] ,
13861386 or_span : Span ,
13871387 place : PlaceBuilder < ' tcx > ,
1388- fake_borrows : & mut Option < FxHashSet < Place < ' tcx > > > ,
1388+ fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
13891389 ) {
13901390 debug ! ( "test_or_pattern:\n candidate={:#?}\n pats={:#?}" , candidate, pats) ;
13911391 let mut or_candidates: Vec < _ > = pats
@@ -1572,7 +1572,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
15721572 mut candidates : & ' b mut [ & ' c mut Candidate < ' pat , ' tcx > ] ,
15731573 block : BasicBlock ,
15741574 otherwise_block : & mut Option < BasicBlock > ,
1575- fake_borrows : & mut Option < FxHashSet < Place < ' tcx > > > ,
1575+ fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
15761576 ) {
15771577 // extract the match-pair from the highest priority candidate
15781578 let match_pair = & candidates. first ( ) . unwrap ( ) . match_pairs [ 0 ] ;
@@ -1715,7 +1715,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
17151715 /// by a MIR pass run after borrow checking.
17161716 fn calculate_fake_borrows < ' b > (
17171717 & mut self ,
1718- fake_borrows : & ' b FxHashSet < Place < ' tcx > > ,
1718+ fake_borrows : & ' b FxIndexSet < Place < ' tcx > > ,
17191719 temp_span : Span ,
17201720 ) -> Vec < ( Place < ' tcx > , Local ) > {
17211721 let tcx = self . tcx ;
@@ -1741,8 +1741,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
17411741 all_fake_borrows. push ( place. as_ref ( ) ) ;
17421742 }
17431743
1744- // Deduplicate and ensure a deterministic order.
1745- all_fake_borrows. sort ( ) ;
17461744 all_fake_borrows. dedup ( ) ;
17471745
17481746 debug ! ( "add_fake_borrows all_fake_borrows = {:?}" , all_fake_borrows) ;
0 commit comments