I am writing a simple memory allocator in Rust, and am having difficulties with lifetimes and aliasing. Specifically, at various points, I need to:
- reclaim the storage held by internal data structures, casting it into raw memory that can be later overwritten at will.
- have data with lifetimes that are unknown and unknowable (from the allocator’s perspective) – the host application controls them.
- use raw pointers everywhere, since
&mutpointers are not allowed to alias.
- use unsafe code everywhere, due to the above.
Is it time to give up on Rust? Or is there a way to make writing such code easier?