stepancheg / grpc-rust

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

use of unstable library feature 'mem_take' #170

Open BStenfors opened 4 years ago

BStenfors commented 4 years ago

Not sure if I am doing something wrong as I am still very new developer in rust but I keep getting the following error when cargo tries to build rust-http2:

use of unstable library feature 'mem_take'

Here is my current Cargo.toml:

[dependencies] diesel = { version = "1.4.0", features = ["mysql"] } dotenv = "0.10" env_logger = "0.6.1"

actix = "0.8.1" actix-web = "1.0.0-rc"

serde = "1.0.90" serde_json = "1.0.39" serde_derive = "1.0.90" json = "*"

reqwest = "0.9.15"

base64 = "0.10.1" url = "1.7.2" rand = "0.6.5" oauth2 = "1.3.0"

protobuf = "2.8.1"

grpc = { git = "https://github.com/stepancheg/grpc-rust" } grpc-protobuf = { git = "https://github.com/stepancheg/grpc-rust" }

tls-api = "0.2.0" tls-api-native-tls = "0.2.0"

futures = "0.1.26" futures-cpupool = "0.1.8"

[build-dependencies] protoc-rust-grpc = { git = "https://github.com/stepancheg/grpc-rust" }

Any ideas or suggestions would much appreciated!!

Cheers

clonejo commented 4 years ago

std::mem::take() is only stable since Rust 1.40.0, so you might just have to get the currently newest stable Rust version.

https://doc.rust-lang.org/std/mem/fn.take.html

BStenfors commented 4 years ago

Awesome! Thanks for the tip. That resolved the mem::take() issue.

Now I am getting these 2 errors:

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

error[E0277]: the trait boundhttpbis::HeaderValue: std::convert::AsRef<[u8]>` is not satisfied --> /Users/bstenfors/.cargo/git/checkouts/grpc-rust-c0d13ba76cd4c520/2e41339/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/bstenfors/.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, DecodeError> { | ----------- required by this bound in base64::decode

error[E0308]: match arms have incompatible types --> /Users/bstenfors/.cargo/git/checkouts/grpc-rust-c0d13ba76cd4c520/2e41339/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

`