rust-lang / futures-rs

Zero-cost asynchronous programming in Rust
https://rust-lang.github.io/futures-rs/
Apache License 2.0
5.43k stars 628 forks source link

futures-util-0.3.31 with unstable write-all-vectored feature enabled cannot be built with Rust 1.69.0-nightly (31f858d9a 2023-02-28) #2893

Closed MageSlayer closed 1 month ago

MageSlayer commented 1 month ago

Hi

I am stuck (for various reasons) with rustc 1.69.0-nightly (31f858d9a 2023-02-28).

However futures-util-0.3.31 cannot be built with it. See below.

error[E0658]: use of unstable library feature 'io_slice_advance'
  --> /home/denis/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.31/src/io/write_all_vectored.rs:22:9
   |
22 |         IoSlice::advance_slices(&mut bufs, 0);
   |         ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #62726 <https://github.com/rust-lang/rust/issues/62726> for more information
   = help: add `#![feature(io_slice_advance)]` to the crate attributes to enable

error[E0658]: use of unstable library feature 'io_slice_advance'
  --> /home/denis/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.31/src/io/write_all_vectored.rs:37:17
   |
37 |                 IoSlice::advance_slices(&mut this.bufs, n);
   |                 ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #62726 <https://github.com/rust-lang/rust/issues/62726> for more information
   = help: add `#![feature(io_slice_advance)]` to the crate attributes to enable

I guess you need to include #![feature(io_slice_advance)] and release next version. Currently 0.3 branch has nothing besides 0.3.31 and is a real blocker.

BR

taiki-e commented 1 month ago

First, write-all-vectored is unstable and any breakage in patch versions is allowed.

https://github.com/rust-lang/futures-rs/blob/7211cb7c5d8d859fa28ae55808c763a09d502827/futures/Cargo.toml#L44-L49 https://github.com/rust-lang/futures-rs/blob/7211cb7c5d8d859fa28ae55808c763a09d502827/futures-util/Cargo.toml#L26-L31

And you are using nightly-specific feature on an older nightly compiler, and many of popular crates in the ecosystem usually supports such cases on a best-effort basis only to the extent that it is not a burden on stable users or maintenance. (io_slice_advance is a feature that stabilized in Rust 1.81.)

In this case it could probably work by just passing -Z crate-attr=feature(io_slice_advance) via RUSTFLAGS, but otherwise I think you have to use newer rustc or apply patch.

taiki-e commented 1 month ago

Also, when sticking with a particular older Rust, I strongly recommend that you commit the lockfile to prevent newer versions of dependencies from being automatically obtained.

This issue's case is a bit of a special case that depends on an unstable feature, but usually, in Rust ecosystem, increasing the minimum supported compiler version is not considered a breaking change.