@@ -76,7 +76,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
7676 ( & ty:: Infer ( ty:: IntVar ( a_id) ) , & ty:: Infer ( ty:: IntVar ( b_id) ) ) => {
7777 self . inner
7878 . borrow_mut ( )
79- . int_unification_table
79+ . int_unification_table ( )
8080 . unify_var_var ( a_id, b_id)
8181 . map_err ( |e| int_unification_error ( a_is_expected, e) ) ?;
8282 Ok ( a)
@@ -98,7 +98,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
9898 ( & ty:: Infer ( ty:: FloatVar ( a_id) ) , & ty:: Infer ( ty:: FloatVar ( b_id) ) ) => {
9999 self . inner
100100 . borrow_mut ( )
101- . float_unification_table
101+ . float_unification_table ( )
102102 . unify_var_var ( a_id, b_id)
103103 . map_err ( |e| float_unification_error ( relation. a_is_expected ( ) , e) ) ?;
104104 Ok ( a)
@@ -133,8 +133,8 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
133133 return Ok ( a) ;
134134 }
135135
136- let a = replace_if_possible ( & mut self . inner . borrow_mut ( ) . const_unification_table , a) ;
137- let b = replace_if_possible ( & mut self . inner . borrow_mut ( ) . const_unification_table , b) ;
136+ let a = replace_if_possible ( & mut self . inner . borrow_mut ( ) . const_unification_table ( ) , a) ;
137+ let b = replace_if_possible ( & mut self . inner . borrow_mut ( ) . const_unification_table ( ) , b) ;
138138
139139 let a_is_expected = relation. a_is_expected ( ) ;
140140
@@ -145,7 +145,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
145145 ) => {
146146 self . inner
147147 . borrow_mut ( )
148- . const_unification_table
148+ . const_unification_table ( )
149149 . unify_var_var ( a_vid, b_vid)
150150 . map_err ( |e| const_unification_error ( a_is_expected, e) ) ?;
151151 return Ok ( a) ;
@@ -179,7 +179,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
179179 ) -> RelateResult < ' tcx , & ' tcx ty:: Const < ' tcx > > {
180180 self . inner
181181 . borrow_mut ( )
182- . const_unification_table
182+ . const_unification_table ( )
183183 . unify_var_value (
184184 vid,
185185 ConstVarValue {
@@ -202,7 +202,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
202202 ) -> RelateResult < ' tcx , Ty < ' tcx > > {
203203 self . inner
204204 . borrow_mut ( )
205- . int_unification_table
205+ . int_unification_table ( )
206206 . unify_var_value ( vid, Some ( val) )
207207 . map_err ( |e| int_unification_error ( vid_is_expected, e) ) ?;
208208 match val {
@@ -219,7 +219,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
219219 ) -> RelateResult < ' tcx , Ty < ' tcx > > {
220220 self . inner
221221 . borrow_mut ( )
222- . float_unification_table
222+ . float_unification_table ( )
223223 . unify_var_value ( vid, Some ( ty:: FloatVarValue ( val) ) )
224224 . map_err ( |e| float_unification_error ( vid_is_expected, e) ) ?;
225225 Ok ( self . tcx . mk_mach_float ( val) )
@@ -266,7 +266,7 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
266266 use self :: RelationDir :: * ;
267267
268268 // Get the actual variable that b_vid has been inferred to
269- debug_assert ! ( self . infcx. inner. borrow_mut( ) . type_variables. probe( b_vid) . is_unknown( ) ) ;
269+ debug_assert ! ( self . infcx. inner. borrow_mut( ) . type_variables( ) . probe( b_vid) . is_unknown( ) ) ;
270270
271271 debug ! ( "instantiate(a_ty={:?} dir={:?} b_vid={:?})" , a_ty, dir, b_vid) ;
272272
@@ -286,7 +286,7 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
286286 "instantiate(a_ty={:?}, dir={:?}, b_vid={:?}, generalized b_ty={:?})" ,
287287 a_ty, dir, b_vid, b_ty
288288 ) ;
289- self . infcx . inner . borrow_mut ( ) . type_variables . instantiate ( b_vid, b_ty) ;
289+ self . infcx . inner . borrow_mut ( ) . type_variables ( ) . instantiate ( b_vid, b_ty) ;
290290
291291 if needs_wf {
292292 self . obligations . push ( Obligation :: new (
@@ -344,7 +344,7 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
344344
345345 debug ! ( "generalize: ambient_variance = {:?}" , ambient_variance) ;
346346
347- let for_universe = match self . infcx . inner . borrow_mut ( ) . type_variables . probe ( for_vid) {
347+ let for_universe = match self . infcx . inner . borrow_mut ( ) . type_variables ( ) . probe ( for_vid) {
348348 v @ TypeVariableValue :: Known { .. } => {
349349 panic ! ( "instantiating {:?} which has a known value {:?}" , for_vid, v, )
350350 }
@@ -356,7 +356,7 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
356356 let mut generalize = Generalizer {
357357 infcx : self . infcx ,
358358 span : self . trace . cause . span ,
359- for_vid_sub_root : self . infcx . inner . borrow_mut ( ) . type_variables . sub_root_var ( for_vid) ,
359+ for_vid_sub_root : self . infcx . inner . borrow_mut ( ) . type_variables ( ) . sub_root_var ( for_vid) ,
360360 for_universe,
361361 ambient_variance,
362362 needs_wf : false ,
@@ -508,14 +508,14 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
508508 // us from creating infinitely sized types.
509509 match t. kind {
510510 ty:: Infer ( ty:: TyVar ( vid) ) => {
511- let vid = self . infcx . inner . borrow_mut ( ) . type_variables . root_var ( vid) ;
512- let sub_vid = self . infcx . inner . borrow_mut ( ) . type_variables . sub_root_var ( vid) ;
511+ let vid = self . infcx . inner . borrow_mut ( ) . type_variables ( ) . root_var ( vid) ;
512+ let sub_vid = self . infcx . inner . borrow_mut ( ) . type_variables ( ) . sub_root_var ( vid) ;
513513 if sub_vid == self . for_vid_sub_root {
514514 // If sub-roots are equal, then `for_vid` and
515515 // `vid` are related via subtyping.
516516 Err ( TypeError :: CyclicTy ( self . root_ty ) )
517517 } else {
518- let probe = self . infcx . inner . borrow_mut ( ) . type_variables . probe ( vid) ;
518+ let probe = self . infcx . inner . borrow_mut ( ) . type_variables ( ) . probe ( vid) ;
519519 match probe {
520520 TypeVariableValue :: Known { value : u } => {
521521 debug ! ( "generalize: known value {:?}" , u) ;
@@ -542,12 +542,13 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
542542 }
543543
544544 let origin =
545- * self . infcx . inner . borrow_mut ( ) . type_variables . var_origin ( vid) ;
546- let new_var_id = self . infcx . inner . borrow_mut ( ) . type_variables . new_var (
547- self . for_universe ,
548- false ,
549- origin,
550- ) ;
545+ * self . infcx . inner . borrow_mut ( ) . type_variables ( ) . var_origin ( vid) ;
546+ let new_var_id = self
547+ . infcx
548+ . inner
549+ . borrow_mut ( )
550+ . type_variables ( )
551+ . new_var ( self . for_universe , false , origin) ;
551552 let u = self . tcx ( ) . mk_ty_var ( new_var_id) ;
552553 debug ! ( "generalize: replacing original vid={:?} with new={:?}" , vid, u) ;
553554 Ok ( u)
@@ -618,7 +619,8 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
618619
619620 match c. val {
620621 ty:: ConstKind :: Infer ( InferConst :: Var ( vid) ) => {
621- let variable_table = & mut self . infcx . inner . borrow_mut ( ) . const_unification_table ;
622+ let mut inner = self . infcx . inner . borrow_mut ( ) ;
623+ let variable_table = & mut inner. const_unification_table ( ) ;
622624 let var_value = variable_table. probe_value ( vid) ;
623625 match var_value. val {
624626 ConstVariableValue :: Known { value : u } => self . relate ( & u, & u) ,
0 commit comments