From 38aab28025015c618bd903ccbf7314f61a656076 Mon Sep 17 00:00:00 2001 From: Robert-M-Lucas <100799838+Robert-M-Lucas@users.noreply.github.com> Date: Wed, 1 Jan 2025 14:23:57 +0000 Subject: [PATCH] Correcting many_boxes_long_lived that BumpAllocator should fail, when it currently succeeds with cargo test -r --- tests/heap_allocation.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/heap_allocation.rs b/tests/heap_allocation.rs index bcdeac65..b4c6db44 100644 --- a/tests/heap_allocation.rs +++ b/tests/heap_allocation.rs @@ -7,6 +7,7 @@ extern crate alloc; use alloc::{boxed::Box, vec::Vec}; +use core::hint::black_box; use blog_os::allocator::HEAP_SIZE; use bootloader::{entry_point, BootInfo}; use core::panic::PanicInfo; @@ -61,6 +62,7 @@ fn many_boxes_long_lived() { let x = Box::new(i); assert_eq!(*x, i); } + black_box(&long_lived); // new - ensures long_lived isn't optimized away assert_eq!(*long_lived, 1); // new }