From 0e8c4503bf4754f4437d8bd45a110b9d0ec671e0 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Thu, 1 Apr 2021 21:45:44 +0200 Subject: Don't recheck obligations if we have learned nothing new This is just the most trivial check: If no inference variables have been updated, and there are no new obligations, we can just skip trying to solve them again. We could be smarter about it, but this already helps quite a bit, and I don't want to touch this too much before we replace the inference table by Chalk's. Fixes #8263 (well, improves it quite a bit). --- crates/hir_ty/src/infer/path.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/hir_ty/src/infer/path.rs') diff --git a/crates/hir_ty/src/infer/path.rs b/crates/hir_ty/src/infer/path.rs index cefa38509..717738789 100644 --- a/crates/hir_ty/src/infer/path.rs +++ b/crates/hir_ty/src/infer/path.rs @@ -258,7 +258,7 @@ impl<'a> InferenceContext<'a> { .push(ty.clone()) .fill(std::iter::repeat_with(|| self.table.new_type_var())) .build(); - self.obligations.push( + self.push_obligation( TraitRef { trait_id: to_chalk_trait_id(trait_), substitution: trait_substs.clone(), -- cgit v1.2.3