@@ -18,6 +18,7 @@ pub use self::RegionResolutionError::*;
1818pub use self :: VarValue :: * ;
1919
2020use super :: { RegionVariableOrigin , SubregionOrigin , TypeTrace , MiscVariable } ;
21+ use super :: unify_key;
2122
2223use rustc_data_structures:: graph:: { self , Direction , NodeIndex } ;
2324use rustc_data_structures:: unify:: { self , UnificationTable } ;
@@ -345,10 +346,13 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
345346 }
346347
347348 pub fn new_region_var ( & self , origin : RegionVariableOrigin ) -> RegionVid {
348- let id = self . num_vars ( ) ;
349+ let vid = RegionVid { index : self . num_vars ( ) } ;
349350 self . var_origins . borrow_mut ( ) . push ( origin. clone ( ) ) ;
350- let vid = self . unification_table . borrow_mut ( ) . new_key ( ( ) ) ;
351- assert_eq ! ( vid. index, id) ;
351+
352+ let u_vid = self . unification_table . borrow_mut ( ) . new_key (
353+ unify_key:: RegionVidKey { min_vid : vid }
354+ ) ;
355+ assert_eq ! ( vid, u_vid) ;
352356 if self . in_snapshot ( ) {
353357 self . undo_log . borrow_mut ( ) . push ( AddVar ( vid) ) ;
354358 }
@@ -581,7 +585,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
581585 }
582586
583587 pub fn opportunistic_resolve_var ( & self , rid : RegionVid ) -> ty:: Region {
584- ty:: ReVar ( self . unification_table . borrow_mut ( ) . find ( rid) )
588+ ty:: ReVar ( self . unification_table . borrow_mut ( ) . find_value ( rid) . min_vid )
585589 }
586590
587591 fn combine_map ( & self , t : CombineMapType ) -> & RefCell < CombineMap > {
0 commit comments