bytecodealliance/rustix

Version 0.38.29 fails to build on Linux

yorickpeterse opened this issue · 1 comments

When building a project that ends up using rustix 0.38.29 on Linux, I get the following errors:

error[E0308]: mismatched types
    --> /var/home/yorickpeterse/homes/arch/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustix-0.38.29/src/backend/linux_raw/net/netdevice.rs:23:78
     |
23   |     unsafe { ifreq.ifr_ifrn.ifrn_name[..if_name_bytes.len()].copy_from_slice(if_name_bytes) };
     |                                                              --------------- ^^^^^^^^^^^^^ expected `&[i8]`, found `&[u8]`
     |                                                              |
     |                                                              arguments to this method are incorrect
     |
     = note: expected reference `&[i8]`
                found reference `&[u8]`
note: method defined here
    --> /var/home/yorickpeterse/homes/arch/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/mod.rs:3595:12
     |
3595 |     pub fn copy_from_slice(&mut self, src: &[T])
     |            ^^^^^^^^^^^^^^^

error[E0604]: only `u8` can be cast as `char`, not `i8`
  --> /var/home/yorickpeterse/homes/arch/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustix-0.38.29/src/backend/linux_raw/net/netdevice.rs:47:22
   |
47 |             .map(|v| *v as char)
   |                      ^^^^^^^^^^ invalid cast
   |
help: try casting from `u8` instead
  --> /var/home/yorickpeterse/homes/arch/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustix-0.38.29/src/backend/linux_raw/net/netdevice.rs:47:22
   |
47 |             .map(|v| *v as char)
   |                      ^^^^^^^^^^

This is using the following dependency specification:

rustix = { version = "^0.38", features = ["fs", "mm", "param", "process", "net", "std", "time"], default-features = false }

The host in this case is Arch Linux, using Rust version 1.74.1.

This doesn't happen when using 0.38.28.

Thanks for the report! This is now fixed in rustix 0.38.30.