don't calculate panic message eagerly

This commit is contained in:
Skgland
2025-12-07 23:06:09 +01:00
committed by Bennet Bleßmann
parent 47e908bf76
commit 580572aec6

View File

@@ -481,11 +481,13 @@ pub(crate) use heap_index_checked;
macro_rules! heap_index {
($idx:expr) => {{
let idx = $idx;
$crate::macros::heap_index_checked!(idx).expect(&format!(
"overflow while calculating heap index {idx} * {} > {}",
std::mem::size_of::<HeapCellValue>(),
usize::MAX,
))
$crate::macros::heap_index_checked!(idx).unwrap_or_else(|| {
panic!(
"overflow while calculating heap index {idx} * {} > {}",
std::mem::size_of::<HeapCellValue>(),
usize::MAX,
)
})
}};
}