]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_infer/infer/nll_relate/mod.rs
perf: Reduce snapshot/rollback overhead
[rust.git] / src / librustc_infer / infer / nll_relate / mod.rs
index a2907e6e373b8cdc6d772ec86978184e7e20200d..7aea26987a29f237d89b5bd093f99de5d4d8c9db 100644 (file)
@@ -311,7 +311,7 @@ fn relate_ty_var<PAIR: VidValuePair<'tcx>>(
         match value_ty.kind {
             ty::Infer(ty::TyVar(value_vid)) => {
                 // Two type variables: just equate them.
-                self.infcx.inner.borrow_mut().type_variables.equate(vid, value_vid);
+                self.infcx.inner.borrow_mut().type_variables().equate(vid, value_vid);
                 return Ok(value_ty);
             }
 
@@ -332,7 +332,7 @@ fn relate_ty_var<PAIR: VidValuePair<'tcx>>(
             assert!(!generalized_ty.has_infer_types_or_consts());
         }
 
-        self.infcx.inner.borrow_mut().type_variables.instantiate(vid, generalized_ty);
+        self.infcx.inner.borrow_mut().type_variables().instantiate(vid, generalized_ty);
 
         // The generalized values we extract from `canonical_var_values` have
         // been fully instantiated and hence the set of scopes we have
@@ -362,7 +362,7 @@ fn generalize_value<T: Relate<'tcx>>(
             delegate: &mut self.delegate,
             first_free_index: ty::INNERMOST,
             ambient_variance: self.ambient_variance,
-            for_vid_sub_root: self.infcx.inner.borrow_mut().type_variables.sub_root_var(for_vid),
+            for_vid_sub_root: self.infcx.inner.borrow_mut().type_variables().sub_root_var(for_vid),
             universe,
         };
 
@@ -859,7 +859,8 @@ fn tys(&mut self, a: Ty<'tcx>, _: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
             }
 
             ty::Infer(ty::TyVar(vid)) => {
-                let variables = &mut self.infcx.inner.borrow_mut().type_variables;
+                let mut inner = self.infcx.inner.borrow_mut();
+                let variables = &mut inner.type_variables();
                 let vid = variables.root_var(vid);
                 let sub_vid = variables.sub_root_var(vid);
                 if sub_vid == self.for_vid_sub_root {
@@ -961,7 +962,8 @@ fn consts(
                 bug!("unexpected inference variable encountered in NLL generalization: {:?}", a);
             }
             ty::ConstKind::Infer(InferConst::Var(vid)) => {
-                let variable_table = &mut self.infcx.inner.borrow_mut().const_unification_table;
+                let mut inner = self.infcx.inner.borrow_mut();
+                let variable_table = &mut inner.const_unification_table();
                 let var_value = variable_table.probe_value(vid);
                 match var_value.val.known() {
                     Some(u) => self.relate(&u, &u),