nix-rust / nix

Rust friendly bindings to *nix APIs
MIT License
2.58k stars 650 forks source link

type mismatch in if_.rs on Solaris #1987

Open gco opened 1 year ago

gco commented 1 year ago

Several flags added for Solaris are 64-bit unsigned integers causing:

error[E0308]: mismatched types
   --> /pool/projects/rust/rust-1.67.0/.cargo/registry/src/github.com-1ecc6299db9ec823/nix-0.22.3/src/macros.rs:56:35
    |
41  |  / macro_rules! libc_bitflags {
42  |  |     (
43  |  |         $(#[$outer:meta])*
44  |  |         pub struct $BitFlags:ident: $T:ty {
...    |
56  |  |                     const $Flag = libc::$Flag $(as $cast)*;
    |  |                                   ^^^^^^^^^^^ expected `i32`, found `i64`
...    |
60  |  |     };
61  |  | }
    |  |_- in this expansion of `libc_bitflags!`
    |
   ::: /pool/projects/rust/rust-1.67.0/.cargo/registry/src/github.com-1ecc6299db9ec823/nix-0.22.3/src/net/if_.rs:20:1
    |
20  | /  libc_bitflags!(
21  | |      /// Standard interface flags, used by `getifaddrs`
22  | |      pub struct InterfaceFlags: libc::c_int {
23  | |          /// Interface is running. (see
...   |
268 | |      }
269 | |  );
    | |__- in this macro invocation
asomers commented 1 year ago

Is this a problem for Illumos too?

gco commented 1 year ago

No, it looks like all of the enumeration tags larger than i32 are conditional on Solaris.

asomers commented 1 year ago

Nix doesn't have any CI for solaris and the maintainers don't make any attempt to support it. But if you submit a PR to fix this, we'll accept it.