stepancheg / grpc-rust

Rust implementation of gRPC
MIT License
1.38k stars 125 forks source link

Build fails on Latest Commit #190

Open friddle opened 3 years ago

friddle commented 3 years ago
error[E0053]: method read has an incompatible type for trait --> grpc-protobuf/src/lib.rs:25:5 25 fn read(&self, buf: Bytes) -> grpc::Result { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct bytes::bytes::Bytes, found struct bytes::Bytes

= note: expected fn pointer fn(&MarshallerProtobuf, bytes::bytes::Bytes) -> std::result::Result<_, _> found fn pointer fn(&MarshallerProtobuf, bytes::Bytes) -> std::result::Result<_, _> = note: perhaps two different versions of crate bytes are being used?

rustc 1.49.0 (e1884a8e3 2020-12-29) commit e8a9b95d834fdcfd811e440dd3fbd0b9a7f71630

thomasantony commented 3 years ago

I was able to get past this by forcing protobuf and protoc-rust to version 2.17.0 in my Cargo.toml. The problem is that later versions of these crates upgrade the version of bytes above 0.5 while grpc-rust still uses bytes v0.5.

friddle commented 3 years ago

thanks

tan-wei commented 3 years ago

Met the same issue:

error[E0308]: mismatched types
  --> C:\Users\Winterreise\scoop\persist\rustup\.cargo\registry\src\github.com-1ecc6299db9ec823\grpc-protobuf-0.8.2\src\lib.rs:27:62
   |
27 |         let mut is = CodedInputStream::from_carllerche_bytes(&buf);
   |                                                              ^^^^ expected struct `bytes::bytes::Bytes`, found struct `bytes::Bytes`
   |
   = note: expected reference `&bytes::bytes::Bytes`
              found reference `&bytes::Bytes`
   = note: perhaps two different versions of crate `bytes` are being used?

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
error: could not compile `grpc-protobuf`
friddle commented 3 years ago
protobuf = "2.14.0"
protoc-rust        = "2.14.0"

cargo update -p protobuf --precise 2.14.0