From b8cae2cf8f7d2a0162d614e25ef95d7e4a5d3677 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 12 Jun 2019 18:05:02 +0300 Subject: check for cancellation when executing queries Note that we can't just remove CheckCanceled trait altogether: sometimes it's useful to check for cancellation while the query is running! We do this, for example, in the name resolution fixed-point loop. --- crates/ra_ide_api/src/db.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'crates/ra_ide_api/src') diff --git a/crates/ra_ide_api/src/db.rs b/crates/ra_ide_api/src/db.rs index b3f395502..82b061419 100644 --- a/crates/ra_ide_api/src/db.rs +++ b/crates/ra_ide_api/src/db.rs @@ -33,8 +33,12 @@ impl salsa::Database for RootDatabase { Canceled::throw() } fn salsa_event(&self, event: impl Fn() -> salsa::Event) { - if let salsa::EventKind::DidValidateMemoizedValue { .. } = event().kind { - self.check_canceled(); + match event().kind { + salsa::EventKind::DidValidateMemoizedValue { .. } + | salsa::EventKind::WillExecute { .. } => { + self.check_canceled(); + } + _ => (), } } } -- cgit v1.2.3