From d05790b9478705c47c9de34bfdee08f823e4e92f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 18 Dec 2018 14:58:54 +0300 Subject: Work around a bug cc #288 --- crates/ra_hir/src/lib.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'crates/ra_hir/src/lib.rs') diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index 760524f6b..80354a49d 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs @@ -143,11 +143,14 @@ impl SourceFileItems { return id; } // This should not happen. Let's try to give a sensible diagnostics. - if let Some((_, i)) = self.arena.iter().find(|(_id, i)| i.range() == item.range()) { - panic!( + if let Some((id, i)) = self.arena.iter().find(|(_id, i)| i.range() == item.range()) { + // FIXME(#288): whyyy are we getting here? + log::error!( "unequal syntax nodes with the same range:\n{:?}\n{:?}", - item, i - ) + item, + i + ); + return id; } panic!( "Can't find {:?} in SourceFileItems:\n{:?}", -- cgit v1.2.3