hyper icon indicating copy to clipboard operation
hyper copied to clipboard

`hyper` v0.14.28 fails to build w/ tokio < v1.27

Open roy-work opened this issue 1 year ago • 0 comments

Version

hyper v0.14.28
tokio v1.26.0 (*)
More complete tree
hyper v0.14.28
├── bytes v1.1.0
├── futures-channel v0.3.30 (*)
├── futures-core v0.3.30
├── futures-util v0.3.30 (*)
├── h2 v0.3.26 (*)
├── http v0.2.8 (*)
├── http-body v0.4.3 (*)
├── httparse v1.8.0
├── httpdate v1.0.2
├── itoa v1.0.1
├── pin-project-lite v0.2.9
├── socket2 v0.5.7
│   └── libc v0.2.154
├── tokio v1.26.0 (*)
├── tower-service v0.3.0
├── tracing v0.1.40 (*)
└── want v0.3.0
    ├── log v0.4.20 (*)
    └── try-lock v0.2.2

Platform

Darwin [snip] 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:08:47 PST 2022; root:xnu-8792.61.2~4/RELEASE_X86_64 x86_64

Description

hyper only declares its dependency on tokio as:

tokio = { version = "1", features = ["sync"] }

However, hyper really requires at least v1.27.

If you attempt to compile hyper, and your lockfile has tokio locked to a lower version, you'll get:

» cargo b
   Compiling hyper v0.14.28
error[E0277]: the trait bound `tokio::net::TcpStream: AsFd` is not satisfied
   --> /Users/roy/.cargo/registry/src/-662ab3103e52a138/hyper-0.14.28/src/server/tcp.rs:215:40
    |
215 |                         let sock_ref = socket2::SockRef::from(&socket);
    |                                        ^^^^^^^^^^^^^^^^^^^^^^ the trait `AsFd` is not implemented for `tokio::net::TcpStream`
    |
    = help: the following other types implement trait `AsFd`:
              &T
              &mut T
              Arc<T>
              BorrowedFd<'_>
              Box<T>
              ChildStderr
              ChildStdin
              ChildStdout
            and 19 others
    = note: required because of the requirements on the impl of `From<&tokio::net::TcpStream>` for `SockRef<'_>`

This error is correct: tokio::net::TcpStream does not impl AsFd: docs at v1.26. That impl isn't added until v1.27.

So, hyper depends on at least tokio v1.27; it'd be nice to have Cargo.toml note that, as that will cause cargo to realize that it must upgrade that dependency in the lockfile:

tokio = { version = "1.27", features = ["sync"] }

It does compile against v1.27.

roy-work avatar Apr 29 '24 22:04 roy-work