aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-03-29 21:15:12 +0100
committerAleksey Kladov <[email protected]>2021-03-29 21:15:12 +0100
commitb35312d4af305e86e360235150cddc263d4adc4a (patch)
tree76d3d06c68364681c5445caaf74628331704afcc /crates/hir_ty
parent2381a54c2f6ff1d97b9d6cb982dde5644f09a396 (diff)
internal: ensure that runaway type-inference doesn't block the main loop
We have a bug where type-checking `per_query_memory_usage` takes a couple of seconds. It also reveals another bug: our type inference is not cancellable.
Diffstat (limited to 'crates/hir_ty')
-rw-r--r--crates/hir_ty/src/infer/expr.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs
index e6ede05ca..6279aa572 100644
--- a/crates/hir_ty/src/infer/expr.rs
+++ b/crates/hir_ty/src/infer/expr.rs
@@ -119,6 +119,8 @@ impl<'a> InferenceContext<'a> {
119 } 119 }
120 120
121 fn infer_expr_inner(&mut self, tgt_expr: ExprId, expected: &Expectation) -> Ty { 121 fn infer_expr_inner(&mut self, tgt_expr: ExprId, expected: &Expectation) -> Ty {
122 self.db.check_canceled();
123
122 let body = Arc::clone(&self.body); // avoid borrow checker problem 124 let body = Arc::clone(&self.body); // avoid borrow checker problem
123 let ty = match &body[tgt_expr] { 125 let ty = match &body[tgt_expr] {
124 Expr::Missing => self.err_ty(), 126 Expr::Missing => self.err_ty(),