Add a few more db.unwind_if_cancelled() calls

This commit is contained in:
Lukas Wirth 2023-09-02 14:39:01 +02:00
parent 2dbc7e3e1a
commit 0bf0563a00
2 changed files with 3 additions and 0 deletions

View file

@ -120,6 +120,7 @@ fn moved_out_of_ref(db: &dyn HirDatabase, body: &MirBody) -> Vec<MovedOutOfRef>
Operand::Constant(_) | Operand::Static(_) => (), Operand::Constant(_) | Operand::Static(_) => (),
}; };
for (_, block) in body.basic_blocks.iter() { for (_, block) in body.basic_blocks.iter() {
db.unwind_if_cancelled();
for statement in &block.statements { for statement in &block.statements {
match &statement.kind { match &statement.kind {
StatementKind::Assign(_, r) => match r { StatementKind::Assign(_, r) => match r {
@ -318,6 +319,7 @@ fn ever_initialized_map(
dfs(db, body, body.start_block, l, &mut result); dfs(db, body, body.start_block, l, &mut result);
} }
for l in body.locals.iter().map(|it| it.0) { for l in body.locals.iter().map(|it| it.0) {
db.unwind_if_cancelled();
if !result[body.start_block].contains_idx(l) { if !result[body.start_block].contains_idx(l) {
result[body.start_block].insert(l, false); result[body.start_block].insert(l, false);
dfs(db, body, body.start_block, l, &mut result); dfs(db, body, body.start_block, l, &mut result);

View file

@ -1446,6 +1446,7 @@ impl DefWithBody {
} }
pub fn diagnostics(self, db: &dyn HirDatabase, acc: &mut Vec<AnyDiagnostic>) { pub fn diagnostics(self, db: &dyn HirDatabase, acc: &mut Vec<AnyDiagnostic>) {
db.unwind_if_cancelled();
let krate = self.module(db).id.krate(); let krate = self.module(db).id.krate();
let (body, source_map) = db.body_with_source_map(self.into()); let (body, source_map) = db.body_with_source_map(self.into());