zkat / cacache-rs

A high-performance, concurrent, content-addressable disk cache, with support for both sync and async APIs. šŸ’©šŸ’µ but for your šŸ¦€
https://crates.io/crates/cacache
Other
532 stars 35 forks source link

Feature "tokio" does not compile with rustc 1.77.1 #69

Open pawurb opened 7 months ago

pawurb commented 7 months ago

Hi. Trying to build project with rustc 1.77.1 and tokio feature enabled outputs multiple compile errors.

  --> /Users/pablo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-io-0.3.30/src/lib.rs:60:12

error[E0308]: mismatched types
  --> /Users/pablo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cacache-13.0.0/src/get.rs:46:9
   |
45 |     ) -> Poll<tokio::io::Result<()>> {
   |          --------------------------- expected `Poll<std::result::Result<(), std::io::Error>>` because of return type
46 |         Pin::new(&mut self.reader).poll_read(cx, buf)
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Poll<Result<(), Error>>`, found `Poll<Result<usize, Error>>`
   |
   = note: expected enum `Poll<std::result::Result<(), _>>`
              found enum `Poll<std::result::Result<usize, _>>`

error[E0599]: no method named `poll_shutdown` found for struct `Pin<&mut AsyncWriter>` in the current scope
   --> /Users/pablo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cacache-13.0.0/src/put.rs:170:36
    |
170 |         Pin::new(&mut self.writer).poll_shutdown(cx)
    |                                    ^^^^^^^^^^^^^ method not found in `Pin<&mut AsyncWriter>`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `poll_shutdown`, perhaps you need to implement it:
            candidate #1: `tokio::io::AsyncWrite`

As a result I cannot use versions 0.13.0 with my project, it still works with 0.12.0. Could you look into resolving it?

zkat commented 7 months ago

...did tokio seriously do a breaking change on their reader signatures in a non-semver-major release? seriously?

zkat commented 7 months ago

Anyway this should be a straightforward fix, although I'd like to know what the tokio version shenanigans are. Happy to take and discuss a PR for this.

pawurb commented 7 months ago

I think it's tokio 1.37.0