External Publication
Visit Post

Another Experiment To Make Unsafe Rust Safer: Preventing UB In MaybeUninit With Compile Time Error

Rust Internals [Unofficial] May 23, 2026
Source

fuji-184:

That is not true without we build that abstraction for MaybeUninit first, because different types + MaybeUninit or Option + MaybeUninit doesn't magically prevent MaybeUninit footguns without building the right abstraction.

Yes, I am not suggesting that you should put MaybeUninit inside an Option; I am saying that Option<T> is the replacement for MaybeUninit<T> for cases where a single runtime flag is sufficient.

In general, things that improve on MaybeUninit don't mention MaybeUninit or have "uninit" on the name, because MaybeUninit is the last resort.

Discussion in the ATmosphere

Loading comments...