-
Notifications
You must be signed in to change notification settings - Fork 173
Closed
Labels
A-postgresArea: PostgreSQL support / deadpool-postgresArea: PostgreSQL support / deadpool-postgresbugCategory: This is a bug.Category: This is a bug.
Description
Sorry for the non-specific title, but I don't really understand this issue. I don't have any guesses as to what's wrong. But here's the most minimal repro I could make.
use deadpool_postgres::{tokio_postgres::Row, GenericClient};
use futures_util::{Stream, StreamExt};
use postgres_types::ToSql;
use std::future::Future;
// this function borrowed from tokio_postgres source code
fn slice_iter<'a>(
s: &'a [&'a (dyn ToSql + Sync)],
) -> impl ExactSizeIterator<Item = &'a dyn ToSql> + 'a {
s.iter().map(|s| *s as _)
}
pub trait PgQuery {
fn query_raw(
db: &impl GenericClient,
params: &[&(dyn ToSql + Sync)],
) -> impl Future<Output = impl Stream<Item = Row>> + Send {
async {
let rows = db.query_raw("SELECT 1", slice_iter(params)).await.unwrap();
rows.map(|row| row.unwrap())
}
}
}
This code compiles with 0.12.1, but with 0.13.2 you get this error:
error[E0308]: mismatched types
--> repro/src/lib.rs:18:9
|
18 | / async {
19 | | let rows = db.query_raw("SELECT 1", slice_iter(params)).await.unwrap();
20 | | rows.map(|row| row.unwrap())
21 | | }
| |_________^ one type is more general than the other
|
= note: expected reference `&dyn ToSql`
found reference `&dyn ToSql`
For more information about this error, try `rustc --explain E0308`.
error: could not compile `repro` (lib) due to 1 previous error
Metadata
Metadata
Assignees
Labels
A-postgresArea: PostgreSQL support / deadpool-postgresArea: PostgreSQL support / deadpool-postgresbugCategory: This is a bug.Category: This is a bug.