Skip to content

Commit 85e8682

Browse files
committed
this maybe
1 parent c79f291 commit 85e8682

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/byteview.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -799,9 +799,8 @@ mod tests {
799799
#[should_panic]
800800
#[cfg(target_pointer_width = "32")]
801801
fn too_large_for_32bit() {
802-
let _bv = ByteView::with_size(
803-
(u32::MAX as usize) - std::mem::size_of::<HeapAllocationHeader>() + 1,
804-
);
802+
let _bv =
803+
ByteView::with_size((u32::MAX as usize) - std::mem::size_of::<HeapAllocationHeader>());
805804
}
806805

807806
// NOTE: Prevent overflow of capacity field for 32-bit targets
@@ -811,7 +810,7 @@ mod tests {
811810
fn too_large_for_32bit_2() {
812811
let _bv = unsafe {
813812
ByteView::with_size_unzeroed(
814-
(u32::MAX as usize) - std::mem::size_of::<HeapAllocationHeader>() + 1,
813+
(u32::MAX as usize) - std::mem::size_of::<HeapAllocationHeader>(),
815814
)
816815
};
817816
}
@@ -821,9 +820,12 @@ mod tests {
821820
fn too_large_for_32bit_threshold() {
822821
let _bv = unsafe {
823822
ByteView::with_size_unzeroed(
824-
(u32::MAX as usize) - std::mem::size_of::<HeapAllocationHeader>(),
823+
(u32::MAX as usize) - std::mem::size_of::<HeapAllocationHeader>() * 2,
825824
)
826825
};
826+
let _bv = ByteView::with_size(
827+
(u32::MAX as usize) - std::mem::size_of::<HeapAllocationHeader>() * 2,
828+
);
827829
}
828830

829831
#[test]

0 commit comments

Comments
 (0)