]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_infer/infer/mod.rs
refactor: Rename Logs to InferCtxtUndoLogs
[rust.git] / src / librustc_infer / infer / mod.rs
index a2cf772e86ec1f925810bd5b7770cb7030fbcd44..90bc1ddc3eb6318833e5052b0f1ab0cf6d4a1892 100644 (file)
@@ -147,7 +147,6 @@ pub struct InferCtxtInner<'tcx> {
     /// that might instantiate a general type variable have an order,
     /// represented by its upper and lower bounds.
     type_variables: type_variable::TypeVariableStorage<'tcx>,
-    undo_log: Logs<'tcx>,
 
     /// Map from const parameter variable to the kind of const it represents.
     const_unification_table: ut::UnificationStorage<ty::ConstVid<'tcx>>,
@@ -197,6 +196,8 @@ pub struct InferCtxtInner<'tcx> {
     /// obligations within. This is expected to be done 'late enough'
     /// that all type inference variables have been bound and so forth.
     region_obligations: Vec<(hir::HirId, RegionObligation<'tcx>)>,
+
+    undo_log: InferCtxtUndoLogs<'tcx>,
 }
 
 impl<'tcx> InferCtxtInner<'tcx> {
@@ -204,7 +205,7 @@ fn new() -> InferCtxtInner<'tcx> {
         InferCtxtInner {
             projection_cache: Default::default(),
             type_variables: type_variable::TypeVariableStorage::new(),
-            undo_log: Logs::default(),
+            undo_log: InferCtxtUndoLogs::default(),
             const_unification_table: ut::UnificationStorage::new(),
             int_unification_table: ut::UnificationStorage::new(),
             float_unification_table: ut::UnificationStorage::new(),
@@ -228,7 +229,11 @@ fn type_variables(&mut self) -> type_variable::TypeVariableTable<'tcx, '_> {
     fn int_unification_table(
         &mut self,
     ) -> ut::UnificationTable<
-        ut::InPlace<ty::IntVid, &mut ut::UnificationStorage<ty::IntVid>, &mut Logs<'tcx>>,
+        ut::InPlace<
+            ty::IntVid,
+            &mut ut::UnificationStorage<ty::IntVid>,
+            &mut InferCtxtUndoLogs<'tcx>,
+        >,
     > {
         ut::UnificationTable::with_log(&mut self.int_unification_table, &mut self.undo_log)
     }
@@ -236,7 +241,11 @@ fn int_unification_table(
     fn float_unification_table(
         &mut self,
     ) -> ut::UnificationTable<
-        ut::InPlace<ty::FloatVid, &mut ut::UnificationStorage<ty::FloatVid>, &mut Logs<'tcx>>,
+        ut::InPlace<
+            ty::FloatVid,
+            &mut ut::UnificationStorage<ty::FloatVid>,
+            &mut InferCtxtUndoLogs<'tcx>,
+        >,
     > {
         ut::UnificationTable::with_log(&mut self.float_unification_table, &mut self.undo_log)
     }
@@ -247,7 +256,7 @@ fn const_unification_table(
         ut::InPlace<
             ty::ConstVid<'tcx>,
             &mut ut::UnificationStorage<ty::ConstVid<'tcx>>,
-            &mut Logs<'tcx>,
+            &mut InferCtxtUndoLogs<'tcx>,
         >,
     > {
         ut::UnificationTable::with_log(&mut self.const_unification_table, &mut self.undo_log)
@@ -343,8 +352,9 @@ fn from(l: traits::UndoLog<'tcx>) -> Self {
     }
 }
 
-pub(crate) type UnificationTable<'a, 'tcx, T> =
-    ut::UnificationTable<ut::InPlace<T, &'a mut ut::UnificationStorage<T>, &'a mut Logs<'tcx>>>;
+pub(crate) type UnificationTable<'a, 'tcx, T> = ut::UnificationTable<
+    ut::InPlace<T, &'a mut ut::UnificationStorage<T>, &'a mut InferCtxtUndoLogs<'tcx>>,
+>;
 
 struct RollbackView<'tcx, 'a> {
     type_variables: &'a mut type_variable::TypeVariableStorage<'tcx>,
@@ -375,18 +385,18 @@ fn reverse(&mut self, undo: UndoLog<'tcx>) {
     }
 }
 
-pub(crate) struct Logs<'tcx> {
+pub(crate) struct InferCtxtUndoLogs<'tcx> {
     logs: Vec<UndoLog<'tcx>>,
     num_open_snapshots: usize,
 }
 
-impl Default for Logs<'_> {
+impl Default for InferCtxtUndoLogs<'_> {
     fn default() -> Self {
         Self { logs: Default::default(), num_open_snapshots: Default::default() }
     }
 }
 
-impl<'tcx, T> UndoLogs<T> for Logs<'tcx>
+impl<'tcx, T> UndoLogs<T> for InferCtxtUndoLogs<'tcx>
 where
     UndoLog<'tcx>: From<T>,
 {
@@ -413,7 +423,7 @@ fn extend<J>(&mut self, undos: J)
     }
 }
 
-impl<'tcx> Snapshots<UndoLog<'tcx>> for Logs<'tcx> {
+impl<'tcx> Snapshots<UndoLog<'tcx>> for InferCtxtUndoLogs<'tcx> {
     type Snapshot = Snapshot<'tcx>;
     fn actions_since_snapshot(&self, snapshot: &Self::Snapshot) -> &[UndoLog<'tcx>] {
         &self.logs[snapshot.undo_len..]
@@ -464,7 +474,7 @@ fn commit(&mut self, snapshot: Self::Snapshot) {
     }
 }
 
-impl<'tcx> Logs<'tcx> {
+impl<'tcx> InferCtxtUndoLogs<'tcx> {
     pub(crate) fn region_constraints(
         &self,
         after: usize,