surf icon indicating copy to clipboard operation
surf copied to clipboard

hyper-client does not actually build

Open CryZe opened this issue 6 years ago • 9 comments

Using

surf = { version = "1.0.1", features = ["hyper-client"], default-features = false }

I get the following compile error:

   Compiling surf v1.0.1
error[E0432]: unresolved import `hyper_tls`
 --> /home/developer/.cargo/registry/src/github.com-1ecc6299db9ec823/surf-1.0.1/src/http_client/hyper.rs:9:5
  |
9 | use hyper_tls::HttpsConnector;
  |     ^^^^^^^^^ use of undeclared type or module `hyper_tls`

error[E0432]: unresolved import `native_tls`
  --> /home/developer/.cargo/registry/src/github.com-1ecc6299db9ec823/surf-1.0.1/src/http_client/hyper.rs:10:5
   |
10 | use native_tls::TlsConnector;
   |     ^^^^^^^^^^ use of undeclared type or module `native_tls`

error[E0034]: multiple applicable items in scope
  --> /home/developer/.cargo/registry/src/github.com-1ecc6299db9ec823/surf-1.0.1/src/http_client/hyper.rs:76:18
   |
76 |                 .map(|chunk| chunk.map(|chunk| chunk.to_vec()))
   |                  ^^^ multiple `map` found
   |
   = note: candidate #1 is defined in an impl of the trait `futures_util::future::FutureExt` for the type `_`
   = help: to disambiguate the method call, write `futures_util::future::FutureExt::map(Compat01As03::new(body), |chunk| chunk.map(|chunk| chunk.to_vec()))` instead
   = note: candidate #2 is defined in an impl of the trait `futures_util::stream::StreamExt` for the type `_`
   = help: to disambiguate the method call, write `futures_util::stream::StreamExt::map(Compat01As03::new(body), |chunk| chunk.map(|chunk| chunk.to_vec()))` instead
note: candidate #3 is defined in the trait `std::iter::Iterator`
   = help: to disambiguate the method call, write `std::iter::Iterator::map(Compat01As03::new(body), |chunk| chunk.map(|chunk| chunk.to_vec()))` instead

error: aborting due to 3 previous errors

which makes sense considering both of tls crates are marked as optional, but are never activated in surf's Cargo.toml.

CryZe avatar Aug 16 '19 09:08 CryZe

Looks like this is potentially fixed by #34

CryZe avatar Aug 16 '19 09:08 CryZe

I'm now stuck at figuring out how to even use this at all.

error[E0433]: failed to resolve: could not find `main` in `runtime`
 --> src/main.rs:3:12
  |
3 | #[runtime::main(runtime_tokio::Tokio)]
  |            ^^^^ could not find `main` in `runtime`

Update: Ah, looks like you need a specific preview version of runtime.

CryZe avatar Aug 16 '19 09:08 CryZe

Update: Ah, looks like you need a specific preview version of runtime.

Hah, yeah sorry -- the 0.0.0 release was never intended to be used, and even if crates.io points to the latest, using cargo add doesn't install pre-releases by default. This has bitten me more than once before already too.

yoshuawuyts avatar Aug 16 '19 12:08 yoshuawuyts

This is still an issue in release 1.0.3

dignifiedquire avatar Nov 10 '19 20:11 dignifiedquire

error[E0432]: unresolved import `hyper_tls`
 --> /Users/dignifiedquire/.cargo/registry/src/github.com-1ecc6299db9ec823/surf-1.0.3/src/http_client/hyper.rs:9:5
  |
9 | use hyper_tls::HttpsConnector;
  |     ^^^^^^^^^ use of undeclared type or module `hyper_tls`

error[E0432]: unresolved import `native_tls`
  --> /Users/dignifiedquire/.cargo/registry/src/github.com-1ecc6299db9ec823/surf-1.0.3/src/http_client/hyper.rs:10:5
   |
10 | use native_tls::TlsConnector;
   |     ^^^^^^^^^^ use of undeclared type or module `native_tls`

error: aborting due to 2 previous errors

dignifiedquire avatar Nov 10 '19 20:11 dignifiedquire

dang yeah, we should fix this. I guess we never merged https://github.com/http-rs/surf/pull/34 which means it's still broken. We should probably use that as a base for fixing this.

yoshuawuyts avatar Nov 15 '19 16:11 yoshuawuyts

kind reminder This is still an issue. I met this when trying surf today. The master seems to have the fix already, but there is no new release yet.

wdv4758h avatar Jan 04 '20 17:01 wdv4758h

@wdv4758h hi, yeah we're working on a new release currently. There are a few breaking changes that are bundled together, but we should have a new release out soon!

yoshuawuyts avatar Jan 10 '20 16:01 yoshuawuyts

@yoshuawuyts good to know, thanks!

wdv4758h avatar Jan 11 '20 02:01 wdv4758h