mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
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.
This commit is contained in:
parent
2381a54c2f
commit
b35312d4af
1 changed files with 2 additions and 0 deletions
|
@ -119,6 +119,8 @@ impl<'a> InferenceContext<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn infer_expr_inner(&mut self, tgt_expr: ExprId, expected: &Expectation) -> Ty {
|
fn infer_expr_inner(&mut self, tgt_expr: ExprId, expected: &Expectation) -> Ty {
|
||||||
|
self.db.check_canceled();
|
||||||
|
|
||||||
let body = Arc::clone(&self.body); // avoid borrow checker problem
|
let body = Arc::clone(&self.body); // avoid borrow checker problem
|
||||||
let ty = match &body[tgt_expr] {
|
let ty = match &body[tgt_expr] {
|
||||||
Expr::Missing => self.err_ty(),
|
Expr::Missing => self.err_ty(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue