Undefined behavior from MaybeUninit
fintelia opened this issue · comments
Jonathan Behrens commented
Attempting to compile the crate with a recent nighly produces the following warning:
warning: the type `&mut reflect::Function` does not permit being left uninitialized --> src/reflect.rs:418:52 | 418 | let mut func: &mut Function = unsafe { std::mem::MaybeUninit::uninit().assume_init() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | this code causes undefined behavior when executed | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done | = note: `#[warn(invalid_value)]` on by default = note: References must be non-null