From 54f30bb6d89165397e6c556bff43fcd81d939818 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 25 Jan 2019 21:16:04 +0300 Subject: nicer behavior in case of bugs We should always reach a fixed point, but if we fail, let's fail loudly! --- crates/ra_hir/src/nameres.rs | 5 +++++ 1 file changed, 5 insertions(+) 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 self.populate_module(module_id, Arc::clone(items)); } + let mut iter = 0; loop { + iter += 1; + if iter > 1000 { + panic!("failed to reach fixedpoint after 1000 iters") + } let processed_imports_count = self.processed_imports.len(); for &module_id in self.input.keys() { self.db.check_canceled(); -- cgit v1.2.3