mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 05:53:45 +00:00
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
This commit is contained in:
commit
35e2f13b5c
1 changed files with 2 additions and 2 deletions
|
@ -151,7 +151,7 @@ impl fmt::Debug for HirFileIdRepr {
|
||||||
|
|
||||||
impl From<FileId> for HirFileId {
|
impl From<FileId> for HirFileId {
|
||||||
fn from(id: FileId) -> Self {
|
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())
|
HirFileId(id.index())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ impl From<FileId> for HirFileId {
|
||||||
impl From<MacroFileId> for HirFileId {
|
impl From<MacroFileId> for HirFileId {
|
||||||
fn from(MacroFileId { macro_call_id: MacroCallId(id) }: MacroFileId) -> Self {
|
fn from(MacroFileId { macro_call_id: MacroCallId(id) }: MacroFileId) -> Self {
|
||||||
let id = id.as_u32();
|
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)
|
HirFileId(id | Self::MACRO_FILE_TAG_MASK)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue