-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
C-bugCategory: bugCategory: bug
Description
If I attempt to build
let mut header = libc::msghdr {
msg_name: std::ptr::null_mut(),
msg_namelen: 0,
msg_iov: std::ptr::null_mut(),
msg_iovlen: 0,
msg_control: std::ptr::null_mut(),
msg_controllen: 0,
msg_flags: 0,
};on a generic linux target this works, but with --target x86_64-unknown-linux-musl I receive:
error: cannot construct `msghdr` with struct literal syntax due to inaccessible fields
--> init/src/main.rs:27:26
|
27 | let mut header = libc::msghdr {
| ^^^^^^^^^^^^
error: aborting due to previous error; 1 warning emitted
This is because of private padding used in the musl version of these types: https://github.com/rust-lang/libc/blob/master/src/unix/linux_like/linux/musl/b64/mod.rs#L92
It is notable that in the types below the padding is made public, making this particular struct inconsistent.
Can be worked around with mem::zeroed but I think these fields should ideally be made public
Metadata
Metadata
Assignees
Labels
C-bugCategory: bugCategory: bug