Here's the error I'm getting:
error[E0381]: use of possibly uninitialized variable: `mbinfo.flags`
--> kernel/src/loader/mod.rs:256:20
|
256 | mbinfo.flags = mbinfo.flags | multiboot::MULTIBOOT_INFO_CMDLINE;
| ^^^^^^^^^^^^ use of possibly uninitialized `mbinfo.flags`
and this is the code:
let mut mbinfo: multiboot::multiboot_info;
mbinfo.flags = 0 as u32;
mbinfo.flags = mbinfo.flags | multiboot::MULTIBOOT_INFO_CMDLINE
Even though I am explicitly initializing it, I get the error. I've tried making the struct derive Default, but the problem is that the struct contains unions, and when I try to derive Default, I get
error: this trait cannot be derived for unions
Any easy way out? Thanks.
The multiboot module was auto generated by bindgen from a header file.
MWE on Rust Playground, code is at the end: