From 4d541f7cf3e3e3835f0556a93e6d300b8d2e32da Mon Sep 17 00:00:00 2001 From: David Barsky Date: Wed, 23 Oct 2024 12:44:57 -0700 Subject: [PATCH] internal: log original syntax on panic --- src/tools/rust-analyzer/crates/span/src/ast_id.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/rust-analyzer/crates/span/src/ast_id.rs b/src/tools/rust-analyzer/crates/span/src/ast_id.rs index 0ebd72e1514..1d81d684511 100644 --- a/src/tools/rust-analyzer/crates/span/src/ast_id.rs +++ b/src/tools/rust-analyzer/crates/span/src/ast_id.rs @@ -224,9 +224,10 @@ fn erased_ast_id(&self, item: &SyntaxNode) -> ErasedFileAstId { match self.map.raw_entry().from_hash(hash, |&idx| self.arena[idx] == ptr) { Some((&idx, &())) => ErasedFileAstId(idx.into_raw().into_u32()), None => panic!( - "Can't find {:?} in AstIdMap:\n{:?}", + "Can't find {:?} in AstIdMap:\n{:?}\n source text: {}", item, self.arena.iter().map(|(_id, i)| i).collect::>(), + item ), } }