External Publication
Visit Post

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

Rust Internals [Unofficial] May 22, 2026
Source

For looking at prior art: checked incremental initialization of an array is basically a Vec<T> of some sort. See also the arrayvec crate. It even provides a method to get a [T; N] if the ArrayVec is fully initialized. That is, there is nothing to do in that case; an existing crate with hundreds of millions of downloads provides a solution.

Checked incremental initialization of an enum or struct is called the “builder pattern”. There are a variety of crates for builders… I dunno which one is most popular, but, say, bon has over 30 million downloads.

Discussion in the ATmosphere

Loading comments...