rustix icon indicating copy to clipboard operation
rustix copied to clipboard

Enable "std" feature on linux-raw-sys when "std" feature is enabled

Open notgull opened this issue 1 year ago • 7 comments

As "std" changes API details from linux-raw-sys that is exposed in the public API, this would be a breaking change.

cc https://github.com/bytecodealliance/rustix/issues/753

notgull avatar Nov 26 '23 02:11 notgull

This currently means that xattr (1.1.0) and rustix can't be used in the same crate. xattr enables the std feature of linux-raw-sys, and rustix then fails compiling if also the net feature of rustix is enabled.

error[E0308]: mismatched types
  --> src/backend/linux_raw/net/addr.rs:39:32
   |
39 |             unix.sun_path[i] = *b;
   |             ----------------   ^^ expected `i8`, found `u8`
   |             |
   |             expected due to the type of this binding

error[E0308]: mismatched types
    --> src/backend/linux_raw/net/addr.rs:52:32
     |
52   |             id.copy_from_slice(name);
     |                --------------- ^^^^ expected `&[i8]`, found `&[u8]`
     |                |
     |                arguments to this method are incorrect
     |
     = note: expected reference `&[i8]`
                found reference `&[u8]`
[...]

sdroege avatar Dec 09 '23 10:12 sdroege

I'm having this same issue. Our build suddently is broken:


error[E0308]: mismatched types
  --> /home/vscode/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustix-0.38.27/src/backend/linux_raw/net/addr.rs:39:32
   |
39 |             unix.sun_path[i] = *b;
   |             ----------------   ^^ expected `i8`, found `u8`
   |             |
   |             expected due to the type of this binding

error[E0308]: mismatched types
  --> /home/vscode/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustix-0.38.27/src/backend/linux_raw/net/addr.rs:52:32
   |
52 |             id.copy_from_slice(name);
   |                --------------- ^^^^ expected `&[i8]`, found `&[u8]`
   |                |
   |                arguments to this method are incorrect
   |
   = note: expected reference `&[i8]`
              found reference `&[u8]`
note: method defined here
  --> /rustc/9d871b0617a4b3d6610b7cee0ab5310dcb542c62/library/core/src/slice/mod.rs:3331:12

edulix avatar Dec 09 '23 13:12 edulix

BTW Possible temporal quick and dirty fix: depend on rustix = "0.38.26" and it works. It got broken in a patch release..

edulix avatar Dec 09 '23 14:12 edulix

xattr 1.1.1 has been released with a fix (reverts the change). I've yanked 1.1.0 now to prevent his from spreading.

Stebalien avatar Dec 09 '23 14:12 Stebalien

(unless your issue is unrelated to xattr)

Stebalien avatar Dec 09 '23 14:12 Stebalien

I've now submitted https://github.com/bytecodealliance/rustix/pull/971 with a fix for this.

sunfishcode avatar Dec 09 '23 16:12 sunfishcode

#971 is now released in rustix 0.38.28.

sunfishcode avatar Dec 09 '23 17:12 sunfishcode