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.
This commit is contained in:
Aleksey Kladov 2019-06-12 18:05:02 +03:00
parent c452d2842c
commit b8cae2cf8f
5 changed files with 6 additions and 6 deletions

View file

@ -33,8 +33,12 @@ impl salsa::Database for RootDatabase {
Canceled::throw()
}
fn salsa_event(&self, event: impl Fn() -> salsa::Event<RootDatabase>) {
if let salsa::EventKind::DidValidateMemoizedValue { .. } = event().kind {
self.check_canceled();
match event().kind {
salsa::EventKind::DidValidateMemoizedValue { .. }
| salsa::EventKind::WillExecute { .. } => {
self.check_canceled();
}
_ => (),
}
}
}