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

use of unstable library feature 'mem_take'

Open BStenfors opened this issue 4 years ago • 2 comments

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

BStenfors avatar Jan 24 '20 23:01 BStenfors

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

clonejo avatar Jan 25 '20 15:01 clonejo

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 bound httpbis::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 traitstd::convert::AsRef<[u8]>is not implemented forhttpbis::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<u8>, DecodeError> { | ----------- required by this bound inbase64::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

`

BStenfors avatar Jan 31 '20 20:01 BStenfors