Skip to content

Commit b3ca06e

Browse files
bors[bot]matklad
andauthored
Merge #8247
8247: internal: ensure that runaway type-inference doesn't block the main loop r=flodiebold a=matklad 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. Co-authored-by: Aleksey Kladov <[email protected]>
2 parents 9bae3ec + b35312d commit b3ca06e

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)