aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-06-12 16:49:39 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-06-12 16:49:39 +0100
commita3a03b65dca9dc174bd58cd3d877ede18fc58637 (patch)
tree464e2eaab5133f137e9d5c36fb34f6f6876c0432
parentc452d2842c2ac7156178a05fe477e8832253a2c4 (diff)
parentb8cae2cf8f7d2a0162d614e25ef95d7e4a5d3677 (diff)
Merge #1398
1398: check for cancellation when executing queries r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r--crates/ra_hir/src/ids.rs1
-rw-r--r--crates/ra_hir/src/nameres.rs1
-rw-r--r--crates/ra_hir/src/ty/infer.rs1
-rw-r--r--crates/ra_hir/src/ty/traits.rs1
-rw-r--r--crates/ra_ide_api/src/db.rs8
5 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs
index 352f9ffd9..033af1632 100644
--- a/crates/ra_hir/src/ids.rs
+++ b/crates/ra_hir/src/ids.rs
@@ -61,7 +61,6 @@ impl HirFileId {
61 db: &impl AstDatabase, 61 db: &impl AstDatabase,
62 file_id: HirFileId, 62 file_id: HirFileId,
63 ) -> Option<TreeArc<SyntaxNode>> { 63 ) -> Option<TreeArc<SyntaxNode>> {
64 db.check_canceled();
65 match file_id.0 { 64 match file_id.0 {
66 HirFileIdRepr::File(file_id) => Some(db.parse(file_id).tree.syntax().to_owned()), 65 HirFileIdRepr::File(file_id) => Some(db.parse(file_id).tree.syntax().to_owned()),
67 HirFileIdRepr::Macro(macro_file) => db.parse_macro(macro_file), 66 HirFileIdRepr::Macro(macro_file) => db.parse_macro(macro_file),
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
index d84134877..3532faf01 100644
--- a/crates/ra_hir/src/nameres.rs
+++ b/crates/ra_hir/src/nameres.rs
@@ -234,7 +234,6 @@ impl CrateDefMap {
234 db: &(impl DefDatabase + AstDatabase), 234 db: &(impl DefDatabase + AstDatabase),
235 krate: Crate, 235 krate: Crate,
236 ) -> Arc<CrateDefMap> { 236 ) -> Arc<CrateDefMap> {
237 db.check_canceled();
238 let _p = profile("crate_def_map_query"); 237 let _p = profile("crate_def_map_query");
239 let def_map = { 238 let def_map = {
240 let edition = krate.edition(db); 239 let edition = krate.edition(db);
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs
index fef0f1d24..e150d7fd8 100644
--- a/crates/ra_hir/src/ty/infer.rs
+++ b/crates/ra_hir/src/ty/infer.rs
@@ -54,7 +54,6 @@ mod unify;
54/// The entry point of type inference. 54/// The entry point of type inference.
55pub fn infer_query(db: &impl HirDatabase, def: DefWithBody) -> Arc<InferenceResult> { 55pub fn infer_query(db: &impl HirDatabase, def: DefWithBody) -> Arc<InferenceResult> {
56 let _p = profile("infer_query"); 56 let _p = profile("infer_query");
57 db.check_canceled();
58 let body = def.body(db); 57 let body = def.body(db);
59 let resolver = def.resolver(db); 58 let resolver = def.resolver(db);
60 let mut ctx = InferenceContext::new(db, body, resolver); 59 let mut ctx = InferenceContext::new(db, body, resolver);
diff --git a/crates/ra_hir/src/ty/traits.rs b/crates/ra_hir/src/ty/traits.rs
index db78f25ca..fda7f9c04 100644
--- a/crates/ra_hir/src/ty/traits.rs
+++ b/crates/ra_hir/src/ty/traits.rs
@@ -83,7 +83,6 @@ pub(crate) fn implements_query(
83 krate: Crate, 83 krate: Crate,
84 trait_ref: Canonical<TraitRef>, 84 trait_ref: Canonical<TraitRef>,
85) -> Option<Solution> { 85) -> Option<Solution> {
86 db.check_canceled();
87 let _p = profile("implements_query"); 86 let _p = profile("implements_query");
88 let goal: chalk_ir::Goal = trait_ref.value.to_chalk(db).cast(); 87 let goal: chalk_ir::Goal = trait_ref.value.to_chalk(db).cast();
89 debug!("goal: {:?}", goal); 88 debug!("goal: {:?}", goal);
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}