Is there a way to emulate the following `ptr_metadata`-dependent code on stable Rust?

Thank you! Would MaybeUninit<u8> then be described as having invalid values? Is that a compiler special case, or can I create types with invalid values, too?