Deallocating Box::from_raw(*mut u8)

Heh, I find it to be a very apt coincidence here, that the detailed unsafe solution of that post was wrong (freeing a Box<u8>): using unsafe is dangerous and error-prone, typos such as Box<u8> instead of Box<[u8]> suffice to cause UB without necessarily triggering compiler errors!

I must insist that when non-unsafe / safe and sound abstractions are available, such as the one showcased in that very thread at the end, those should be preferred to rolling your own unsafe.

Indeed, another example is what @Phlopsi mentioned: even if you get the Box<[u8]> part right, you'd still have the potential issue, w.r.t. aliasing, of using mem::forget instead of a preemptive ManuallyDrop.