aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-05-29 20:13:03 +0100
committerAleksey Kladov <[email protected]>2019-05-29 20:13:03 +0100
commit6bcc1b8b9e9ff90a5c5442dce230dba5995ca5b5 (patch)
treeda33b8ea0737c561ec33a00e900cfd23bd0a0199 /crates/ra_hir
parenta9373c4220a677e4ba38185d14fce67b56fdee44 (diff)
add cacellation checks to expensive queries
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/nameres.rs1
-rw-r--r--crates/ra_hir/src/nameres/collector.rs1
-rw-r--r--crates/ra_hir/src/ty/traits.rs1
3 files changed, 3 insertions, 0 deletions
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
index 9b9212bfc..42dcac332 100644
--- a/crates/ra_hir/src/nameres.rs
+++ b/crates/ra_hir/src/nameres.rs
@@ -222,6 +222,7 @@ fn or(left: ItemOrMacro, right: ItemOrMacro) -> ItemOrMacro {
222 222
223impl CrateDefMap { 223impl CrateDefMap {
224 pub(crate) fn crate_def_map_query(db: &impl DefDatabase, krate: Crate) -> Arc<CrateDefMap> { 224 pub(crate) fn crate_def_map_query(db: &impl DefDatabase, krate: Crate) -> Arc<CrateDefMap> {
225 db.check_canceled();
225 let _p = profile("crate_def_map_query"); 226 let _p = profile("crate_def_map_query");
226 let def_map = { 227 let def_map = {
227 let edition = krate.edition(db); 228 let edition = krate.edition(db);
diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs
index ba7ea0017..af8ac064c 100644
--- a/crates/ra_hir/src/nameres/collector.rs
+++ b/crates/ra_hir/src/nameres/collector.rs
@@ -112,6 +112,7 @@ where
112 // main name resolution fixed-point loop. 112 // main name resolution fixed-point loop.
113 let mut i = 0; 113 let mut i = 0;
114 loop { 114 loop {
115 self.db.check_canceled();
115 match (self.resolve_imports(), self.resolve_macros()) { 116 match (self.resolve_imports(), self.resolve_macros()) {
116 (ReachedFixedPoint::Yes, ReachedFixedPoint::Yes) => break, 117 (ReachedFixedPoint::Yes, ReachedFixedPoint::Yes) => break,
117 _ => i += 1, 118 _ => i += 1,
diff --git a/crates/ra_hir/src/ty/traits.rs b/crates/ra_hir/src/ty/traits.rs
index e6c78c0d4..fc90f56d5 100644
--- a/crates/ra_hir/src/ty/traits.rs
+++ b/crates/ra_hir/src/ty/traits.rs
@@ -82,6 +82,7 @@ pub(crate) fn implements_query(
82 krate: Crate, 82 krate: Crate,
83 trait_ref: Canonical<TraitRef>, 83 trait_ref: Canonical<TraitRef>,
84) -> Option<Solution> { 84) -> Option<Solution> {
85 db.check_canceled();
85 let _p = profile("implements_query"); 86 let _p = profile("implements_query");
86 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();
87 debug!("goal: {:?}", goal); 88 debug!("goal: {:?}", goal);