Get the latest tech news
Unsafe Rust is harder than C
Or: The Most Expensive Linked List I’ve Ever Written
The language pervasively assumes values of any type can be moved with a memcpy, so writing a data structure that violates that assumption makes the public APIs themselves awkward. Panics can be caught, but the program would remain in a state where safe code can access dangling pointers and cause undefined behavior (UB). MIRI failed, complaining that p was formed from the perpetual&mut returned by Box::leak and therefore it’s UB to create a shared&MyThing reference to it at any point thenceforth.
Or read this on Hacker News