-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed as not planned
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.S-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.Status: This issue has no reproduction and needs a reproduction to make progress.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I have a minimal example, using stable rustc 1.39.0:
Cargo.toml:
[package]
name = "minimal"
version = "0.1.0"
authors = ["Erlend Langseth <3rlend@gmail.com>"]
edition = "2018"
[dependencies]
# Actix
actix = "0.9.0-alpha.2"
actix-web = "2.0.0-alpha.6"
actix-rt = "1.0.0"
actix-http = "1.0.0"
# Redis
redis-async = "0.6.1"
actix-redis = "0.8.0-alpha.1"
# Serde
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
main.rs:
use actix::prelude::*;
use actix_web::{
get,
web::{Json, Data},
App, HttpServer,
};
use serde::{Deserialize};
use redis_async::{
resp_array,
resp::{RespValue, FromResp},
client::paired::PairedConnection as RedisConn
};
use std::str::FromStr;
use std::net::SocketAddr;
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
let redis = redis_async::client::paired::paired_connect(&SocketAddr::from_str("127.0.0.1:6379").unwrap()).await.unwrap();
HttpServer::new(move || {
App::new()
.wrap(actix_web::middleware::Logger::new(
"%a \"%r\" Response: %s %b",
))
.data(redis.clone())
.service(get_health)
})
.bind("127.0.0.1:8088")?
.start()
.await
}
impl<'a, T: Deserialize<'a>> FromResp for T {
fn from_resp_int(resp: RespValue) -> Result<T, redis_async::error::Error> {
unimplemented!()
}
}
#[get("/admin/v1/health")]
async fn get_health(redis: Data<RedisConn>) -> Json<usize> {
let res = redis.send::<String>(resp_array!["PING"]).await;
Json(0)
}
It yields this weird error:
error[E0283]: type annotations required: cannot resolve `std::string::String: redis_async::resp::FromResp`
--> src/main.rs:43:21
|
43 | let res = redis.send::<String>(resp_array!["PING"]).await;
| ^^^^
error: aborting due to previous error
Whereas the real error is impl<'a, T: Deserialize<'a>> FromResp for T. If I remove that impl block, it's all fine.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.S-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.Status: This issue has no reproduction and needs a reproduction to make progress.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.