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

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

Open
roy-work opened this issue Apr 29, 2024 · 0 comments
Open

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

roy-work opened this issue Apr 29, 2024 · 0 comments
Labels
C-bug Category: bug. Something is wrong. This is bad!

Comments

@roy-work
Copy link

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 roy-work added the C-bug Category: bug. Something is wrong. This is bad! label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug. Something is wrong. This is bad!
Projects
None yet
Development

No branches or pull requests

1 participant