about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Barsky <me@davidbarsky.com>2024-10-23 12:44:57 -0700
committerDavid Barsky <me@davidbarsky.com>2024-10-23 12:56:00 -0700
commit4d541f7cf3e3e3835f0556a93e6d300b8d2e32da (patch)
treec432c58fc08b132da735aa4c2789a7cbba26e91c
parent6f8e75a559fa9250c212dfcd8b1de8ec64588076 (diff)
downloadrust-4d541f7cf3e3e3835f0556a93e6d300b8d2e32da.tar.gz
rust-4d541f7cf3e3e3835f0556a93e6d300b8d2e32da.zip
internal: log original syntax on panic
-rw-r--r--src/tools/rust-analyzer/crates/span/src/ast_id.rs3
1 files changed, 2 insertions, 1 deletions
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 @@ impl AstIdMap {
         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::<Vec<_>>(),
+                item
             ),
         }
     }