grpc-rust icon indicating copy to clipboard operation
grpc-rust copied to clipboard

Build fails on Rust 1.36.0

Open amrx101 opened this issue 4 years ago • 2 comments

--> /home/amit/.cargo/registry/src/github.com-1ecc6299db9ec823/bytes-0.5.4/src/bytes.rs:911:1
|
911 | const _: [(); 0 - mem::align_of::<Shared>() % 2] = []; // Assert that the alignment of `Shared` is        divisible by 2.
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/54912

Build fails on Rust 1.36.0

amrx101 avatar Jan 27 '20 05:01 amrx101

Hmmm. ./build-all.sh produces different errors with Rust 1.40.0:

   Compiling grpc v0.7.0 (path to grpc-rust/grpc)
error[E0277]: the trait bound `httpbis::HeaderValue: std::convert::AsRef<[u8]>` is not satisfied
  --> grpc/src/proto/metadata.rs:78:48
   |
78 |             true => Bytes::from(base64::decode(&header.value)?),
   |                                                ^^^^^^^^^^^^^ the trait `std::convert::AsRef<[u8]>` is not implemented for `httpbis::HeaderValue`
   |
  ::: /Users/gnormington/.cargo/registry/src/github.com-1ecc6299db9ec823/base64-0.9.3/src/decode.rs:68:27
   |
68 | pub fn decode<T: ?Sized + AsRef<[u8]>>(input: &T) -> Result<Vec<u8>, DecodeError> {
   |                           ----------- required by this bound in `base64::decode`

error[E0308]: match arms have incompatible types
  --> grpc/src/proto/metadata.rs:79:22
   |
77 |           let value = match key.is_bin() {
   |  _____________________-
78 | |             true => Bytes::from(base64::decode(&header.value)?),
   | |                     ------------------------------------------- this is found to be of type `bytes::Bytes`
79 | |             false => header.value,
   | |                      ^^^^^^^^^^^^ expected struct `bytes::Bytes`, found struct `httpbis::HeaderValue`
80 | |         };
   | |_________- `match` arms have incompatible types
   |
   = note: expected type `bytes::Bytes`
              found type `httpbis::HeaderValue`

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `grpc`.

glyn avatar Jan 29 '20 16:01 glyn

I am getting the same error(s) on 1.40.0 as well.

I was on 1.39.0 but upgraded as suggested to avoid an error from an unstable version of mem::take.

Have you had any luck resolving the issue?

Just updated rust to stable 1.41.0 and still getting the same error.

BStenfors avatar Feb 04 '20 19:02 BStenfors