From 18543cf3529f63ff3cd865b8cf3751b087cd8f47 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Wed, 13 Oct 2021 12:11:11 -0700 Subject: [PATCH] Adapt to retyping of HEAP_START_ADDRESS from usize to u64 --- examples/rust/custom-heap/src/entrypoint.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/rust/custom-heap/src/entrypoint.rs b/examples/rust/custom-heap/src/entrypoint.rs index 4f7df1a97f2..911619f22df 100644 --- a/examples/rust/custom-heap/src/entrypoint.rs +++ b/examples/rust/custom-heap/src/entrypoint.rs @@ -17,9 +17,9 @@ struct BumpAllocator; unsafe impl std::alloc::GlobalAlloc for BumpAllocator { #[inline] unsafe fn alloc(&self, layout: Layout) -> *mut u8 { - const POS_PTR: *mut usize = HEAP_START_ADDRESS as *mut usize; - const TOP_ADDRESS: usize = HEAP_START_ADDRESS + HEAP_LENGTH; - const BOTTOM_ADDRESS: usize = HEAP_START_ADDRESS + size_of::<*mut u8>(); + const POS_PTR: *mut usize = HEAP_START_ADDRESS as usize as *mut usize; + const TOP_ADDRESS: usize = HEAP_START_ADDRESS as usize + HEAP_LENGTH; + const BOTTOM_ADDRESS: usize = HEAP_START_ADDRESS as usize + size_of::<*mut u8>(); let mut pos = *POS_PTR; if pos == 0 {