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 { macro_rules! heap_index {
($idx:expr) => {{ ($idx:expr) => {{
let idx = $idx; let idx = $idx;
$crate::macros::heap_index_checked!(idx).expect(&format!( $crate::macros::heap_index_checked!(idx).unwrap_or_else(|| {
panic!(
"overflow while calculating heap index {idx} * {} > {}", "overflow while calculating heap index {idx} * {} > {}",
std::mem::size_of::<HeapCellValue>(), std::mem::size_of::<HeapCellValue>(),
usize::MAX, usize::MAX,
)) )
})
}}; }};
} }