http-rs / surf

Fast and friendly HTTP client framework for async Rust
https://docs.rs/surf
Apache License 2.0
1.45k stars 119 forks source link

Surf 2.2.0 does not compile #313

Closed ufoscout closed 2 years ago

ufoscout commented 2 years ago

I created a new empty cargo project with this cargo.toml file:

[package]
name = "try_surf"
version = "0.1.0"
edition = "2018"

[dependencies]
surf = "2.2"

I don't know why, but it refuses to compile:

> cargo clean && cargo check
   Compiling version_check v0.9.3
   Compiling proc-macro2 v1.0.27
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.73
   Compiling libc v0.2.98
    Checking cfg-if v1.0.0
   Compiling typenum v1.13.0
   Compiling cc v1.0.69
   Compiling autocfg v1.0.1
   Compiling futures-core v0.3.15
   Compiling pkg-config v0.3.19
   Compiling log v0.4.14
   Compiling memchr v2.4.0
    Checking pin-project-lite v0.2.7
    Checking futures-io v0.3.15
   Compiling serde_derive v1.0.126
    Checking subtle v2.4.1
   Compiling proc-macro-hack v0.5.19
    Checking opaque-debug v0.3.0
    Checking cache-padded v1.1.1
    Checking parking v2.0.0
   Compiling serde v1.0.126
    Checking fastrand v1.4.1
    Checking waker-fn v1.1.0
    Checking percent-encoding v2.1.0
    Checking event-listener v2.5.1
    Checking lazy_static v1.4.0
    Checking once_cell v1.8.0
    Checking slab v0.4.3
    Checking matches v0.1.8
   Compiling getrandom v0.1.16
    Checking tinyvec_macros v0.1.0
    Checking ppv-lite86 v0.2.10
    Checking cpuid-bool v0.2.0
   Compiling crossbeam-utils v0.8.5
    Checking async-task v4.0.3
   Compiling ryu v1.0.5
    Checking itoa v0.4.7
   Compiling const_fn v0.4.8
    Checking scopeguard v1.1.0
   Compiling futures-channel v0.3.15
    Checking atomic-waker v1.0.0
   Compiling anyhow v1.0.42
    Checking cpufeatures v0.1.5
   Compiling curl v0.4.38
   Compiling serde_json v1.0.64
    Checking pin-utils v0.1.0
    Checking futures-sink v0.3.15
   Compiling isahc v0.9.14
    Checking base64 v0.13.0
    Checking fnv v1.0.7
    Checking bytes v1.0.1
   Compiling proc-macro-nested v0.1.7
   Compiling http-types v2.11.1
    Checking data-encoding v2.3.2
   Compiling futures-task v0.3.15
    Checking openssl-probe v0.1.4
   Compiling async-trait v0.1.50
    Checking infer v0.2.3
   Compiling encoding_rs v0.8.28
    Checking bytes v0.5.6
    Checking mime v0.3.16
   Compiling generic-array v0.14.4
   Compiling value-bag v1.0.0-alpha.7
   Compiling standback v0.2.17
   Compiling unicase v2.6.0
   Compiling time v0.2.27
   Compiling cookie v0.14.4
   Compiling futures-macro v0.3.15
   Compiling futures-util v0.3.15
    Checking concurrent-queue v1.2.2
    Checking tracing-core v0.1.18
    Checking async-mutex v1.4.0
    Checking async-lock v2.4.0
    Checking unicode-bidi v0.3.5
    Checking form_urlencoded v1.0.1
    Checking tinyvec v1.2.0
    Checking lock_api v0.4.4
   Compiling libnghttp2-sys v0.1.6+1.43.0
   Compiling openssl-sys v0.9.65
   Compiling libz-sys v1.1.3
   Compiling curl-sys v0.4.44+curl-7.77.0
    Checking http v0.2.4
    Checking spinning_top v0.2.4
    Checking async-channel v1.6.1
   Compiling quote v1.0.9
    Checking unicode-normalization v0.1.19
    Checking socket2 v0.4.0
    Checking getrandom v0.2.3
    Checking num_cpus v1.13.0
    Checking futures-lite v1.12.0
    Checking flume v0.9.2
    Checking sluice v0.5.4
    Checking rand_core v0.6.3
    Checking rand_core v0.5.1
    Checking dashmap v4.0.2
   Compiling mime_guess v2.0.3
    Checking idna v0.2.3
    Checking cipher v0.2.5
    Checking universal-hash v0.4.0
    Checking digest v0.9.0
    Checking crypto-mac v0.10.0
    Checking aead v0.3.2
    Checking block-buffer v0.9.0
    Checking rand_chacha v0.3.1
    Checking rand_chacha v0.2.2
    Checking async-executor v1.4.1
    Checking blocking v1.0.2
    Checking polyval v0.4.5
    Checking aes-soft v0.6.4
    Checking ctr v0.6.0
    Checking hmac v0.10.1
    Checking sha2 v0.9.5
    Checking rand v0.8.4
    Checking rand v0.7.3
    Checking ghash v0.3.1
    Checking hkdf v0.10.0
    Checking aes v0.6.0
    Checking aes-gcm v0.8.0
   Compiling ctor v0.1.20
   Compiling time-macros-impl v0.1.2
   Compiling thiserror-impl v1.0.26
   Compiling pin-project-internal v1.0.7
   Compiling tracing-attributes v0.1.15
    Checking time-macros v0.1.1
    Checking polling v2.1.0
    Checking kv-log-macro v1.0.7
    Checking thiserror v1.0.26
    Checking async-io v1.6.0
    Checking tracing v0.1.26
    Checking async-global-executor v2.0.2
    Checking async-std v1.9.0
    Checking pin-project v1.0.7
    Checking tracing-futures v0.2.5
    Checking url v2.2.2
    Checking serde_qs v0.7.2
    Checking serde_urlencoded v0.7.0
    Checking http-client v6.4.1
    Checking surf v2.2.0
error[E0432]: unresolved import `crate::Client`
 --> /home/ufo/.cargo/registry/src/github.com-1ecc6299db9ec823/surf-2.2.0/src/request_builder.rs:6:13
  |
6 | use crate::{Client, Error, Request, Response, Result};
  |             ^^^^^^
  |             |
  |             no `Client` in the root
  |             help: a similar name exists in the module (notice the capitalization): `client`

error[E0432]: unresolved import `crate::Client`
  --> /home/ufo/.cargo/registry/src/github.com-1ecc6299db9ec823/surf-2.2.0/src/middleware/mod.rs:59:13
   |
59 | use crate::{Client, Request, Response, Result};
   |             ^^^^^^
   |             |
   |             no `Client` in the root
   |             help: a similar name exists in the module (notice the capitalization): `client`

error[E0432]: unresolved import `crate::Client`
  --> /home/ufo/.cargo/registry/src/github.com-1ecc6299db9ec823/surf-2.2.0/src/middleware/redirect/mod.rs:17:13
   |
17 | use crate::{Client, Result};
   |             ^^^^^^
   |             |
   |             no `Client` in the root
   |             help: a similar name exists in the module (notice the capitalization): `client`

error[E0432]: unresolved import `client::Client`
  --> /home/ufo/.cargo/registry/src/github.com-1ecc6299db9ec823/surf-2.2.0/src/lib.rs:94:9
   |
94 | pub use client::Client;
   |         ^^^^^^^^^^^^^^ no `Client` in `client`

error[E0412]: cannot find type `Client` in this scope
  --> /home/ufo/.cargo/registry/src/github.com-1ecc6299db9ec823/surf-2.2.0/src/client.rs:57:16
   |
57 | impl Clone for Client {
   |                ^^^^^^ not found in this scope

error[E0412]: cannot find type `Client` in this scope
  --> /home/ufo/.cargo/registry/src/github.com-1ecc6299db9ec823/surf-2.2.0/src/client.rs:73:21
   |
73 | impl fmt::Debug for Client {
   |                     ^^^^^^ not found in this scope

error[E0412]: cannot find type `Client` in this scope
  --> /home/ufo/.cargo/registry/src/github.com-1ecc6299db9ec823/surf-2.2.0/src/client.rs:80:18
   |
80 | impl Default for Client {
   |                  ^^^^^^ not found in this scope

error[E0412]: cannot find type `Client` in this scope
  --> /home/ufo/.cargo/registry/src/github.com-1ecc6299db9ec823/surf-2.2.0/src/client.rs:86:6
   |
86 | impl Client {
   |      ^^^^^^ not found in this scope

error[E0119]: conflicting implementations of trait `middleware::Middleware` for type `middleware::logger::native::Logger`
  --> /home/ufo/.cargo/registry/src/github.com-1ecc6299db9ec823/surf-2.2.0/src/middleware/mod.rs:79:1
   |
79 | / impl<F> Middleware for F
80 | | where
81 | |     F: Send
82 | |         + Sync
...  |
88 | |     }
89 | | }
   | |_^ conflicting implementation for `middleware::logger::native::Logger`
   | 
  ::: /home/ufo/.cargo/registry/src/github.com-1ecc6299db9ec823/surf-2.2.0/src/middleware/logger/native.rs:24:1
   |
24 |   impl Middleware for Logger {
   |   -------------------------- first implementation here

error: aborting due to 9 previous errors

Some errors have detailed explanations: E0119, E0412, E0432.
For more information about an error, try `rustc --explain E0119`.
error: could not compile `surf`

To learn more, run the command again with --verbose.

I am building it on a Ubuntu 20.04 machine with rustc 1.53.0 (53cb7b09b 2021-06-17)

ufoscout commented 2 years ago

Quite strange, I deleted the ~/.cargo/registry/src/github.com-1ecc6299db9ec823/surf-2.2.0 folder on my machine and now it compiles with no issues. So the issue was caused by the cargo local cache.

Fishrock123 commented 2 years ago

I was wondering for a brief moment if it wasn't cache corruption somehow. Looks like it was. Glad to hear haha.