aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-25 18:16:04 +0000
committerAleksey Kladov <[email protected]>2019-01-25 20:13:07 +0000
commit54f30bb6d89165397e6c556bff43fcd81d939818 (patch)
tree1fcdb0f3cbe34c6a9982adaac6251c6d1a8a9e48
parente53eab3f25af2ebd381012f1b34f0bc52c6951eb (diff)
nicer behavior in case of bugs
We should always reach a fixed point, but if we fail, let's fail loudly!
-rw-r--r--crates/ra_hir/src/nameres.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
index 028c1882f..5193900e0 100644
--- a/crates/ra_hir/src/nameres.rs
+++ b/crates/ra_hir/src/nameres.rs
@@ -190,7 +190,12 @@ where
190 self.populate_module(module_id, Arc::clone(items)); 190 self.populate_module(module_id, Arc::clone(items));
191 } 191 }
192 192
193 let mut iter = 0;
193 loop { 194 loop {
195 iter += 1;
196 if iter > 1000 {
197 panic!("failed to reach fixedpoint after 1000 iters")
198 }
194 let processed_imports_count = self.processed_imports.len(); 199 let processed_imports_count = self.processed_imports.len();
195 for &module_id in self.input.keys() { 200 for &module_id in self.input.keys() {
196 self.db.check_canceled(); 201 self.db.check_canceled();