Correcting many_boxes_long_lived that BumpAllocator should fail, when it currently succeeds with cargo test -r

This commit is contained in:
Robert-M-Lucas
2025-01-01 14:23:57 +00:00
parent 39ee714093
commit 38aab28025

View File

@@ -7,6 +7,7 @@
extern crate alloc; extern crate alloc;
use alloc::{boxed::Box, vec::Vec}; use alloc::{boxed::Box, vec::Vec};
use core::hint::black_box;
use blog_os::allocator::HEAP_SIZE; use blog_os::allocator::HEAP_SIZE;
use bootloader::{entry_point, BootInfo}; use bootloader::{entry_point, BootInfo};
use core::panic::PanicInfo; use core::panic::PanicInfo;
@@ -61,6 +62,7 @@ fn many_boxes_long_lived() {
let x = Box::new(i); let x = Box::new(i);
assert_eq!(*x, i); assert_eq!(*x, i);
} }
black_box(&long_lived); // new - ensures long_lived isn't optimized away
assert_eq!(*long_lived, 1); // new assert_eq!(*long_lived, 1); // new
} }