Skip to content

Commit

Permalink
minor: Add messages to some asserts for better debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Veykril committed Dec 14, 2023
1 parent 7cc6b0f commit 070cd4e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/base-db/src/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ 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())
}
}

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)
}
}
Expand Down

0 comments on commit 070cd4e

Please sign in to comment.