@@ -2,7 +2,7 @@ use std::collections::BTreeMap;
22
33use super :: NormalizeExt ;
44use super :: { ObligationCause , PredicateObligation , SelectionContext } ;
5- use rustc_data_structures:: fx:: FxHashSet ;
5+ use rustc_data_structures:: fx:: { FxHashSet , FxIndexMap } ;
66use rustc_errors:: Diag ;
77use rustc_hir:: def_id:: DefId ;
88use rustc_infer:: infer:: { InferCtxt , InferOk } ;
@@ -432,7 +432,7 @@ pub struct BoundVarReplacer<'me, 'tcx> {
432432 // nice to remove these since we already have the `kind` in the placeholder; we really just need
433433 // the `var` (but we *could* bring that into scope if we were to track them as we pass them).
434434 mapped_regions : BTreeMap < ty:: PlaceholderRegion , ty:: BoundRegion > ,
435- mapped_types : BTreeMap < ty:: PlaceholderType , ty:: BoundTy > ,
435+ mapped_types : FxIndexMap < ty:: PlaceholderType , ty:: BoundTy > ,
436436 mapped_consts : BTreeMap < ty:: PlaceholderConst , ty:: BoundVar > ,
437437 // The current depth relative to *this* folding, *not* the entire normalization. In other words,
438438 // the depth of binders we've passed here.
@@ -452,11 +452,11 @@ impl<'me, 'tcx> BoundVarReplacer<'me, 'tcx> {
452452 ) -> (
453453 T ,
454454 BTreeMap < ty:: PlaceholderRegion , ty:: BoundRegion > ,
455- BTreeMap < ty:: PlaceholderType , ty:: BoundTy > ,
455+ FxIndexMap < ty:: PlaceholderType , ty:: BoundTy > ,
456456 BTreeMap < ty:: PlaceholderConst , ty:: BoundVar > ,
457457 ) {
458458 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 ( ) ;
460460 let mapped_consts: BTreeMap < ty:: PlaceholderConst , ty:: BoundVar > = BTreeMap :: new ( ) ;
461461
462462 let mut replacer = BoundVarReplacer {
@@ -575,7 +575,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for BoundVarReplacer<'_, 'tcx> {
575575pub struct PlaceholderReplacer < ' me , ' tcx > {
576576 infcx : & ' me InferCtxt < ' tcx > ,
577577 mapped_regions : BTreeMap < ty:: PlaceholderRegion , ty:: BoundRegion > ,
578- mapped_types : BTreeMap < ty:: PlaceholderType , ty:: BoundTy > ,
578+ mapped_types : FxIndexMap < ty:: PlaceholderType , ty:: BoundTy > ,
579579 mapped_consts : BTreeMap < ty:: PlaceholderConst , ty:: BoundVar > ,
580580 universe_indices : & ' me [ Option < ty:: UniverseIndex > ] ,
581581 current_index : ty:: DebruijnIndex ,
@@ -585,7 +585,7 @@ impl<'me, 'tcx> PlaceholderReplacer<'me, 'tcx> {
585585 pub fn replace_placeholders < T : TypeFoldable < TyCtxt < ' tcx > > > (
586586 infcx : & ' me InferCtxt < ' tcx > ,
587587 mapped_regions : BTreeMap < ty:: PlaceholderRegion , ty:: BoundRegion > ,
588- mapped_types : BTreeMap < ty:: PlaceholderType , ty:: BoundTy > ,
588+ mapped_types : FxIndexMap < ty:: PlaceholderType , ty:: BoundTy > ,
589589 mapped_consts : BTreeMap < ty:: PlaceholderConst , ty:: BoundVar > ,
590590 universe_indices : & ' me [ Option < ty:: UniverseIndex > ] ,
591591 value : T ,
0 commit comments