@@ -431,7 +431,7 @@ pub struct BoundVarReplacer<'me, 'tcx> {
431
431
// These three maps track the bound variable that were replaced by placeholders. It might be
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
- mapped_regions : BTreeMap < ty:: PlaceholderRegion , ty:: BoundRegion > ,
434
+ mapped_regions : FxIndexMap < ty:: PlaceholderRegion , ty:: BoundRegion > ,
435
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,
@@ -451,11 +451,12 @@ impl<'me, 'tcx> BoundVarReplacer<'me, 'tcx> {
451
451
value : T ,
452
452
) -> (
453
453
T ,
454
- BTreeMap < ty:: PlaceholderRegion , ty:: BoundRegion > ,
454
+ FxIndexMap < ty:: PlaceholderRegion , ty:: BoundRegion > ,
455
455
FxIndexMap < ty:: PlaceholderType , ty:: BoundTy > ,
456
456
BTreeMap < ty:: PlaceholderConst , ty:: BoundVar > ,
457
457
) {
458
- let mapped_regions: BTreeMap < ty:: PlaceholderRegion , ty:: BoundRegion > = BTreeMap :: new ( ) ;
458
+ let mapped_regions: FxIndexMap < ty:: PlaceholderRegion , ty:: BoundRegion > =
459
+ FxIndexMap :: default ( ) ;
459
460
let mapped_types: FxIndexMap < ty:: PlaceholderType , ty:: BoundTy > = FxIndexMap :: default ( ) ;
460
461
let mapped_consts: BTreeMap < ty:: PlaceholderConst , ty:: BoundVar > = BTreeMap :: new ( ) ;
461
462
@@ -574,7 +575,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for BoundVarReplacer<'_, 'tcx> {
574
575
/// The inverse of [`BoundVarReplacer`]: replaces placeholders with the bound vars from which they came.
575
576
pub struct PlaceholderReplacer < ' me , ' tcx > {
576
577
infcx : & ' me InferCtxt < ' tcx > ,
577
- mapped_regions : BTreeMap < ty:: PlaceholderRegion , ty:: BoundRegion > ,
578
+ mapped_regions : FxIndexMap < ty:: PlaceholderRegion , ty:: BoundRegion > ,
578
579
mapped_types : FxIndexMap < ty:: PlaceholderType , ty:: BoundTy > ,
579
580
mapped_consts : BTreeMap < ty:: PlaceholderConst , ty:: BoundVar > ,
580
581
universe_indices : & ' me [ Option < ty:: UniverseIndex > ] ,
@@ -584,7 +585,7 @@ pub struct PlaceholderReplacer<'me, 'tcx> {
584
585
impl < ' me , ' tcx > PlaceholderReplacer < ' me , ' tcx > {
585
586
pub fn replace_placeholders < T : TypeFoldable < TyCtxt < ' tcx > > > (
586
587
infcx : & ' me InferCtxt < ' tcx > ,
587
- mapped_regions : BTreeMap < ty:: PlaceholderRegion , ty:: BoundRegion > ,
588
+ mapped_regions : FxIndexMap < ty:: PlaceholderRegion , ty:: BoundRegion > ,
588
589
mapped_types : FxIndexMap < ty:: PlaceholderType , ty:: BoundTy > ,
589
590
mapped_consts : BTreeMap < ty:: PlaceholderConst , ty:: BoundVar > ,
590
591
universe_indices : & ' me [ Option < ty:: UniverseIndex > ] ,
0 commit comments