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 uses featured functions from socket2 without explicitly requiring it #3045

Closed
papey opened this issue Nov 7, 2022 · 2 comments
Closed
Labels
C-bug Category: bug. Something is wrong. This is bad!

Comments

@papey
Copy link

papey commented Nov 7, 2022

Version

As a transitive dependency from another crate, I get hyper = "0.14.22", and then socket2 = "0.4.7".

Platform

Linux elrond 6.0.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 03 Nov 2022 18:01:58 +0000 x86_64 GNU/Linux

Description

When a project adds hyper as a transitive dependency, some required features for socket2 are missing, and my project wont compile.

I tried this code:

some_create = "X.Y.Z # adds transitive deps on hyper"

Cargo.lock :

[[package]]
name = "hyper"
version = "0.14.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abfba89e19b959ca163c7752ba59d737c1ceea53a5d31a149c805446fc958064"
dependencies = [
 "bytes",
 "futures-channel",
 "futures-core",
 "futures-util",
 "h2",
 "http",
 "http-body",
 "httparse",
 "httpdate",
 "itoa 1.0.4",
 "pin-project-lite",
 "socket2", <-----
 "tokio",
 "tower-service",
 "tracing",
 "want",
]

I expected to see this happen: cargo build without issue

Instead, this happened:

  --> /home/papey/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/hyper-0.14.22/src/server/tcp.rs:59:12
   |
59 |         ka.with_interval(interval)
   |            ^^^^^^^^^^^^^ method not found in `TcpKeepalive`

It leads to those lines or this doc in socket2.

With the mention of :

Available on
crate feature all and (Android or DragonFly BSD or FreeBSD or Fuchsia or illumos or Linux or NetBSD or Apple or Windows)
only.

On the function used in hyper tcp.rs.

Adding socket2 as a dep with the the all feature in my Cargo.toml file solve the issue :

socket2 = { version = "0.4.7", features = ["all"] }

but it's far from ideal and I think that it should be enabled on hyper side. I can work on the PR if you want.

Thanks 👍

@papey papey added the C-bug Category: bug. Something is wrong. This is bad! label Nov 7, 2022
@LucioFranco
Copy link
Member

Should be fixed via #3047

@papey
Copy link
Author

papey commented Nov 8, 2022

Fix confirmed ! Kudos @LucioFranco && @seanmonstar 👍

@papey papey closed this as completed Nov 8, 2022
papey added a commit to papey/scaphandre that referenced this issue Nov 8, 2022
papey added a commit to papey/scaphandre that referenced this issue Nov 10, 2022
papey added a commit to papey/scaphandre that referenced this issue Feb 11, 2023
papey added a commit to papey/scaphandre that referenced this issue Mar 11, 2023
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

2 participants