@Psilon Ну кстати мири не ругается на такой код:
let mut buf: [u8; 10] = unsafe { mem::MaybeUninit::uninit().assume_init() };
for hole in &mut buf {
*hole = 10;
}
dbg!(buf);
🤔
Ладно, забайте, прям в доках:
Moreover, uninitialized memory is special in that the compiler knows that it does not have a fixed value. This makes it undefined behavior to have uninitialized data in a variable even if that variable has an integer type, which otherwise can hold any fixed bit pattern