@@ -136,6 +136,8 @@ pub(crate) fn type_check<'mir, 'tcx>(
136136 upvars : & [ Upvar < ' tcx > ] ,
137137) -> MirTypeckResults < ' tcx > {
138138 let implicit_region_bound = infcx. tcx . mk_region ( ty:: ReVar ( universal_regions. fr_fn_body ) ) ;
139+ let mut universe_causes = FxHashMap :: default ( ) ;
140+ universe_causes. insert ( ty:: UniverseIndex :: from_u32 ( 0 ) , UniverseInfo :: other ( ) ) ;
139141 let mut constraints = MirTypeckRegionConstraints {
140142 placeholder_indices : PlaceholderIndices :: default ( ) ,
141143 placeholder_index_to_region : IndexVec :: default ( ) ,
@@ -144,7 +146,7 @@ pub(crate) fn type_check<'mir, 'tcx>(
144146 member_constraints : MemberConstraintSet :: default ( ) ,
145147 closure_bounds_mapping : Default :: default ( ) ,
146148 type_tests : Vec :: default ( ) ,
147- universe_causes : IndexVec :: from_elem_n ( UniverseInfo :: other ( ) , 1 ) ,
149+ universe_causes,
148150 } ;
149151
150152 let CreateResult {
@@ -159,9 +161,9 @@ pub(crate) fn type_check<'mir, 'tcx>(
159161 & mut constraints,
160162 ) ;
161163
162- for _ in ty:: UniverseIndex :: ROOT ..infcx. universe ( ) {
164+ for u in ty:: UniverseIndex :: ROOT ..infcx. universe ( ) {
163165 let info = UniverseInfo :: other ( ) ;
164- constraints. universe_causes . push ( info) ;
166+ constraints. universe_causes . insert ( u , info) ;
165167 }
166168
167169 let mut borrowck_context = BorrowCheckContext {
@@ -924,7 +926,7 @@ crate struct MirTypeckRegionConstraints<'tcx> {
924926 crate closure_bounds_mapping :
925927 FxHashMap < Location , FxHashMap < ( RegionVid , RegionVid ) , ( ConstraintCategory , Span ) > > ,
926928
927- crate universe_causes : IndexVec < ty:: UniverseIndex , UniverseInfo < ' tcx > > ,
929+ crate universe_causes : FxHashMap < ty:: UniverseIndex , UniverseInfo < ' tcx > > ,
928930
929931 crate type_tests : Vec < TypeTest < ' tcx > > ,
930932}
0 commit comments