nix
nix copied to clipboard
Undefined behavior in SigEvent::new on Fuchsia
Beginning with Rust 1.41.0, the build fails on Fuchsia. It triggers this error:
error: the type `libc::sigevent` does not permit zero-initialization
--> src/sys/signal.rs:855:36
|
855 | let mut sev = unsafe { mem::MaybeUninit::<libc::sigevent>::zeroed().assume_init() };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| this code causes undefined behavior when executed
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
Judging by the comments, the original author of Fuchsia support was aware of this problem and tried to work around it. However, later versions of the Rust compiler got more strict. Since Fuchsia is tier-3, I'm just going to disable the warning (on Fuchsia only) to fix the build. @amanda-tait would you be willing to devise a more permanent solution?