Skip to content

Commit b35312d

Browse files
committed
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.
1 parent 2381a54 commit b35312d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

crates/hir_ty/src/infer/expr.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ impl<'a> InferenceContext<'a> {
119119
}
120120

121121
fn infer_expr_inner(&mut self, tgt_expr: ExprId, expected: &Expectation) -> Ty {
122+
self.db.check_canceled();
123+
122124
let body = Arc::clone(&self.body); // avoid borrow checker problem
123125
let ty = match &body[tgt_expr] {
124126
Expr::Missing => self.err_ty(),

0 commit comments

Comments
 (0)