Another Experiment To Make Unsafe Rust Safer: Preventing UB In MaybeUninit With Compile Time Error
Rust Internals [Unofficial]
May 22, 2026
To be frank, this doesn’t help whatsoever. UninitGuard::write might as well just ignore the self parameter -- its contents get overwritten anyway -- in which case you take a T and return a fancy guard that just lets you use the inner data as a T. If you already have a T, you don’t need to do that.
IMO, the best safe equivalent of MaybeUninit<T> is Option<T>.
Discussion in the ATmosphere