diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs index deb536e511..c5386cb794 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, - // FIXME: snapshot pending_obligations? + pending_obligations: Vec>>, type_variable_table_snapshot: Vec, } @@ -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