From 070cd4e8b0c22444aea71f9a8b6fe7ae9847ebeb Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 14 Dec 2023 10:24:41 +0100 Subject: [PATCH] minor: Add messages to some asserts for better debugging --- crates/base-db/src/span.rs | 4 ++-- 1 file 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 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { impl From 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 @@ fn from(id: FileId) -> Self { impl From 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) } }