aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-06-12 16:05:02 +0100
committerAleksey Kladov <[email protected]>2019-06-12 16:47:55 +0100
commitb8cae2cf8f7d2a0162d614e25ef95d7e4a5d3677 (patch)
tree464e2eaab5133f137e9d5c36fb34f6f6876c0432 /crates/ra_ide_api/src
parentc452d2842c2ac7156178a05fe477e8832253a2c4 (diff)
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.
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r--crates/ra_ide_api/src/db.rs8
1 files changed, 6 insertions, 2 deletions
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 {
33 Canceled::throw() 33 Canceled::throw()
34 } 34 }
35 fn salsa_event(&self, event: impl Fn() -> salsa::Event<RootDatabase>) { 35 fn salsa_event(&self, event: impl Fn() -> salsa::Event<RootDatabase>) {
36 if let salsa::EventKind::DidValidateMemoizedValue { .. } = event().kind { 36 match event().kind {
37 self.check_canceled(); 37 salsa::EventKind::DidValidateMemoizedValue { .. }
38 | salsa::EventKind::WillExecute { .. } => {
39 self.check_canceled();
40 }
41 _ => (),
38 } 42 }
39 } 43 }
40} 44}