Open erikschul opened 8 months ago
One temporary solution is to disable the diagnostic: "rust-analyzer.diagnostics.disabled": ["E0308"]
I see that as well, have been for about 6 months.
I am seeing another similar case when using deadpool-redis
.
The code below gives expected Option<String>, found String
E0308 error, though cargo check
does not give any error.
rust-analyzer version: 0.3.2045 rustc version: 1.79.0 (129f3b996 2024-06-10) editor or extension: VSCode code snippet to reproduce:
async fn get_from_redis(
redis_connection: &mut deadpool_redis::Connection,
key: String,
) -> Option<String> {
redis_connection
.get::<String, Option<String>>(key)
.await
.unwrap()
}
// deadpool-redis version is "0.15.1"
The signature for the get
method is as below, it looks like analyzer is applying the annotation for RV
to both K
and RV
.
pub fn get<'a, K, RV>(&'a mut self, key: K) -> crate::types::RedisFuture<'a, RV>
When using
deadpool_postgres
, I encountered incorrect diagnostic for E0308. The code compiles correctly, but rust-analyzer shows an error.See details: https://github.com/bikeshedder/deadpool/issues/296#issuecomment-1884727407
rust-analyzer version: 0.3.1799-standalone (af4010184 2024-01-07)
rustc version: rustc 1.75.0 (82e1608df 2023-12-21)
Possibly related: