Work around a bug

cc #288
This commit is contained in:
Aleksey Kladov 2018-12-18 14:58:54 +03:00
parent f3ea21ac16
commit d05790b947
1 changed files with 7 additions and 4 deletions

View File

@ -143,11 +143,14 @@ impl SourceFileItems {
return id; return id;
} }
// This should not happen. Let's try to give a sensible diagnostics. // 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()) { if let Some((id, i)) = self.arena.iter().find(|(_id, i)| i.range() == item.range()) {
panic!( // FIXME(#288): whyyy are we getting here?
log::error!(
"unequal syntax nodes with the same range:\n{:?}\n{:?}", "unequal syntax nodes with the same range:\n{:?}\n{:?}",
item, i item,
) i
);
return id;
} }
panic!( panic!(
"Can't find {:?} in SourceFileItems:\n{:?}", "Can't find {:?} in SourceFileItems:\n{:?}",