internal: log original syntax on panic

This commit is contained in:
David Barsky 2024-10-23 12:44:57 -07:00
parent f0f26053ab
commit e5c656d804

View file

@ -224,9 +224,10 @@ impl AstIdMap {
match self.map.raw_entry().from_hash(hash, |&idx| self.arena[idx] == ptr) { match self.map.raw_entry().from_hash(hash, |&idx| self.arena[idx] == ptr) {
Some((&idx, &())) => ErasedFileAstId(idx.into_raw().into_u32()), Some((&idx, &())) => ErasedFileAstId(idx.into_raw().into_u32()),
None => panic!( None => panic!(
"Can't find {:?} in AstIdMap:\n{:?}", "Can't find {:?} in AstIdMap:\n{:?}\n source text: {}",
item, item,
self.arena.iter().map(|(_id, i)| i).collect::<Vec<_>>(), self.arena.iter().map(|(_id, i)| i).collect::<Vec<_>>(),
item
), ),
} }
} }