Skip to content

Commit 35e2f13

Browse files
committed
Auto merge of #16121 - Veykril:assert-messages, r=Veykril
minor: Add messages to some asserts for better debugging cc #16118
2 parents dd07f1f + 070cd4e commit 35e2f13

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/base-db/src/span.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,15 @@ impl fmt::Debug for HirFileIdRepr {
151151

152152
impl From<FileId> for HirFileId {
153153
fn from(id: FileId) -> Self {
154-
assert!(id.index() < Self::MAX_FILE_ID);
154+
assert!(id.index() < Self::MAX_FILE_ID, "FileId index {} is too large", id.index());
155155
HirFileId(id.index())
156156
}
157157
}
158158

159159
impl From<MacroFileId> for HirFileId {
160160
fn from(MacroFileId { macro_call_id: MacroCallId(id) }: MacroFileId) -> Self {
161161
let id = id.as_u32();
162-
assert!(id < Self::MAX_FILE_ID);
162+
assert!(id < Self::MAX_FILE_ID, "MacroCallId index {} is too large", id);
163163
HirFileId(id | Self::MACRO_FILE_TAG_MASK)
164164
}
165165
}

0 commit comments

Comments
 (0)