about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-12-14 09:27:14 +0000
committerbors <bors@rust-lang.org>2023-12-14 09:27:14 +0000
commit35e2f13b5c62f62f33185eb7d335e741d3e1645b (patch)
treea1a93a5e7215f40d9a429432f8653395e83313ef
parentdd07f1f2fbfd7e6ea581240af07131a1b7368b0f (diff)
parent070cd4e8b0c22444aea71f9a8b6fe7ae9847ebeb (diff)
downloadrust-35e2f13b5c62f62f33185eb7d335e741d3e1645b.tar.gz
rust-35e2f13b5c62f62f33185eb7d335e741d3e1645b.zip
Auto merge of #16121 - Veykril:assert-messages, r=Veykril
minor: Add messages to some asserts for better debugging

cc https://github.com/rust-lang/rust-analyzer/issues/16118
-rw-r--r--crates/base-db/src/span.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/base-db/src/span.rs b/crates/base-db/src/span.rs
index 3464f4cb6d1..6f027ce9394 100644
--- a/crates/base-db/src/span.rs
+++ b/crates/base-db/src/span.rs
@@ -151,7 +151,7 @@ impl fmt::Debug for HirFileIdRepr {
 
 impl From<FileId> for HirFileId {
     fn from(id: FileId) -> Self {
-        assert!(id.index() < Self::MAX_FILE_ID);
+        assert!(id.index() < Self::MAX_FILE_ID, "FileId index {} is too large", id.index());
         HirFileId(id.index())
     }
 }
@@ -159,7 +159,7 @@ impl From<FileId> for HirFileId {
 impl From<MacroFileId> for HirFileId {
     fn from(MacroFileId { macro_call_id: MacroCallId(id) }: MacroFileId) -> Self {
         let id = id.as_u32();
-        assert!(id < Self::MAX_FILE_ID);
+        assert!(id < Self::MAX_FILE_ID, "MacroCallId index {} is too large", id);
         HirFileId(id | Self::MACRO_FILE_TAG_MASK)
     }
 }