#Undefined Behavior with custom allocator and Box
11 messages · Page 1 of 1 (latest)
here's the whole source
and here's the repo https://github.com/OliveIsAWord/allocator
i'm using the paste crate to create unique identifiers but other than that, no external crates
let ptr = unsafe { NonNull::new_unchecked(self.stack.as_ptr().add(aligned) as *mut _) }; isn’t the problem here that you’re casting a *const T to *mut?
oh dear you are absolutely correct, that fixed it
i knew that returned a const pointer, but i missed it because NonNull::as_ptr returns a mut pointer
thanks!