Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 0.38.29 fails to build on Linux #983

Closed
yorickpeterse opened this issue Jan 12, 2024 · 1 comment · Fixed by #984
Closed

Version 0.38.29 fails to build on Linux #983

yorickpeterse opened this issue Jan 12, 2024 · 1 comment · Fixed by #984

Comments

@yorickpeterse
Copy link

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.

sunfishcode added a commit that referenced this issue Jan 12, 2024
When rustix is compiled with default-features = false, and linux-raw-sys
is compiled with no_std, there is a difference in the signedness of
`c_char`; fix rustix's code to handle this.

Fixes #983.
sunfishcode added a commit that referenced this issue Jan 12, 2024
When rustix is compiled with default-features = false, and linux-raw-sys
is compiled with no_std, there is a difference in the signedness of
`c_char`; fix rustix's code to handle this.

Fixes #983.
sunfishcode added a commit that referenced this issue Jan 12, 2024
When rustix is compiled with default-features = false, and linux-raw-sys
is compiled with no_std, there is a difference in the signedness of
`c_char`; fix rustix's code to handle this.

Fixes #983.
@sunfishcode
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants