@@ -2,7 +2,7 @@ use std::collections::BTreeMap;
2
2
3
3
use super :: NormalizeExt ;
4
4
use super :: { ObligationCause , PredicateObligation , SelectionContext } ;
5
- use rustc_data_structures:: fx:: FxHashSet ;
5
+ use rustc_data_structures:: fx:: { FxHashSet , FxIndexMap } ;
6
6
use rustc_errors:: Diag ;
7
7
use rustc_hir:: def_id:: DefId ;
8
8
use rustc_infer:: infer:: { InferCtxt , InferOk } ;
@@ -432,7 +432,7 @@ pub struct BoundVarReplacer<'me, 'tcx> {
432
432
// nice to remove these since we already have the `kind` in the placeholder; we really just need
433
433
// the `var` (but we *could* bring that into scope if we were to track them as we pass them).
434
434
mapped_regions : BTreeMap < ty:: PlaceholderRegion , ty:: BoundRegion > ,
435
- mapped_types : BTreeMap < ty:: PlaceholderType , ty:: BoundTy > ,
435
+ mapped_types : FxIndexMap < ty:: PlaceholderType , ty:: BoundTy > ,
436
436
mapped_consts : BTreeMap < ty:: PlaceholderConst , ty:: BoundVar > ,
437
437
// The current depth relative to *this* folding, *not* the entire normalization. In other words,
438
438
// the depth of binders we've passed here.
@@ -452,11 +452,11 @@ impl<'me, 'tcx> BoundVarReplacer<'me, 'tcx> {
452
452
) -> (
453
453
T ,
454
454
BTreeMap < ty:: PlaceholderRegion , ty:: BoundRegion > ,
455
- BTreeMap < ty:: PlaceholderType , ty:: BoundTy > ,
455
+ FxIndexMap < ty:: PlaceholderType , ty:: BoundTy > ,
456
456
BTreeMap < ty:: PlaceholderConst , ty:: BoundVar > ,
457
457
) {
458
458
let mapped_regions: BTreeMap < ty:: PlaceholderRegion , ty:: BoundRegion > = BTreeMap :: new ( ) ;
459
- let mapped_types: BTreeMap < ty:: PlaceholderType , ty:: BoundTy > = BTreeMap :: new ( ) ;
459
+ let mapped_types: FxIndexMap < ty:: PlaceholderType , ty:: BoundTy > = FxIndexMap :: default ( ) ;
460
460
let mapped_consts: BTreeMap < ty:: PlaceholderConst , ty:: BoundVar > = BTreeMap :: new ( ) ;
461
461
462
462
let mut replacer = BoundVarReplacer {
@@ -575,7 +575,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for BoundVarReplacer<'_, 'tcx> {
575
575
pub struct PlaceholderReplacer < ' me , ' tcx > {
576
576
infcx : & ' me InferCtxt < ' tcx > ,
577
577
mapped_regions : BTreeMap < ty:: PlaceholderRegion , ty:: BoundRegion > ,
578
- mapped_types : BTreeMap < ty:: PlaceholderType , ty:: BoundTy > ,
578
+ mapped_types : FxIndexMap < ty:: PlaceholderType , ty:: BoundTy > ,
579
579
mapped_consts : BTreeMap < ty:: PlaceholderConst , ty:: BoundVar > ,
580
580
universe_indices : & ' me [ Option < ty:: UniverseIndex > ] ,
581
581
current_index : ty:: DebruijnIndex ,
@@ -585,7 +585,7 @@ impl<'me, 'tcx> PlaceholderReplacer<'me, 'tcx> {
585
585
pub fn replace_placeholders < T : TypeFoldable < TyCtxt < ' tcx > > > (
586
586
infcx : & ' me InferCtxt < ' tcx > ,
587
587
mapped_regions : BTreeMap < ty:: PlaceholderRegion , ty:: BoundRegion > ,
588
- mapped_types : BTreeMap < ty:: PlaceholderType , ty:: BoundTy > ,
588
+ mapped_types : FxIndexMap < ty:: PlaceholderType , ty:: BoundTy > ,
589
589
mapped_consts : BTreeMap < ty:: PlaceholderConst , ty:: BoundVar > ,
590
590
universe_indices : & ' me [ Option < ty:: UniverseIndex > ] ,
591
591
value : T ,
0 commit comments