diff --git a/postgres/tests/postgres.rs b/postgres/tests/postgres.rs index 7e64b42..7ccf5d7 100644 --- a/postgres/tests/postgres.rs +++ b/postgres/tests/postgres.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, env, time::Duration}; +use std::{collections::HashMap, env, pin::Pin, time::Duration}; use futures::future; use serde::{Deserialize, Serialize}; @@ -212,6 +212,27 @@ async fn statement_caches_clear() { assert!(client1.statement_cache.size() == 0); } +#[tokio::test] +async fn sync_trait_get() { + let pool = create_pool(); + + type ClosureFuture = Pin + Send + Sync>>; + async fn test_closure ClosureFuture + Send + Sync + 'static>(_: T) { + return; + } + + test_closure(move |_| Box::pin(async move {})).await; + assert!(true); + + test_closure(move |_| { + let pool = pool.clone(); + Box::pin(async move { + pool.get().await; + }) + }); + assert!(true); +} + struct Env { backup: HashMap>, }