Tim McNamara @timclicks.dev · Oct 30

Today, I've been spending too much time wondering about what the safety comment in this example should be. play.rust-lang.org/?version=st...

4 likes 1 replies

?

Replies

David Koloski · Oct 30

The docs say "both the argument and the result must be valid at their given type", so if I were writing the safety comment I'd document why the array of MaybeUninit<u32> is a valid array of u32. They both have the same layout and bit patterns, and the elements are all initialized, so it's sound.