about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Diebold <flodiebold@gmail.com>2022-03-17 14:29:39 +0100
committerFlorian Diebold <flodiebold@gmail.com>2022-03-17 17:04:32 +0100
commit59b5696aaa43f2b1193028848aede20979f3e37f (patch)
tree8ec3a77ca235c4aef568fe541af1546034ab2c96
parent8f5b6ac556f1b05ee93d8424b1875083f506a802 (diff)
downloadrust-59b5696aaa43f2b1193028848aede20979f3e37f.tar.gz
rust-59b5696aaa43f2b1193028848aede20979f3e37f.zip
Snapshot obligations
-rw-r--r--crates/hir_ty/src/infer/unify.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs
index deb536e5114..c5386cb7941 100644
--- a/crates/hir_ty/src/infer/unify.rs
+++ b/crates/hir_ty/src/infer/unify.rs
@@ -146,7 +146,7 @@ pub(crate) struct InferenceTable<'a> {
 
 pub(crate) struct InferenceTableSnapshot {
     var_table_snapshot: chalk_solve::infer::InferenceSnapshot<Interner>,
-    // FIXME: snapshot pending_obligations?
+    pending_obligations: Vec<Canonicalized<InEnvironment<Goal>>>,
     type_variable_table_snapshot: Vec<TypeVariableData>,
 }
 
@@ -365,12 +365,18 @@ impl<'a> InferenceTable<'a> {
     pub(crate) fn snapshot(&mut self) -> InferenceTableSnapshot {
         let var_table_snapshot = self.var_unification_table.snapshot();
         let type_variable_table_snapshot = self.type_variable_table.clone();
-        InferenceTableSnapshot { var_table_snapshot, type_variable_table_snapshot }
+        let pending_obligations = self.pending_obligations.clone();
+        InferenceTableSnapshot {
+            var_table_snapshot,
+            pending_obligations,
+            type_variable_table_snapshot,
+        }
     }
 
     pub(crate) fn rollback_to(&mut self, snapshot: InferenceTableSnapshot) {
         self.var_unification_table.rollback_to(snapshot.var_table_snapshot);
         self.type_variable_table = snapshot.type_variable_table_snapshot;
+        self.pending_obligations = snapshot.pending_obligations;
     }
 
     /// Checks an obligation without registering it. Useful mostly to check