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:
@@ -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();
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user