diff --git a/crates/db_schema/src/traits.rs b/crates/db_schema/src/traits.rs index 736bceb95..c26ba939a 100644 --- a/crates/db_schema/src/traits.rs +++ b/crates/db_schema/src/traits.rs @@ -29,6 +29,11 @@ pub type Delete = DeleteStatement<::Table, = dsl::Find<::Table, >::IdType>; +// When using `RunQueryDsl::execute`, directly building futures with `Box::pin` and `TryFutureExt::and_then` +// instead of `async` + `await` fixes weird compile errors. +// https://github.com/rust-lang/rust/issues/102211 +// When using `RunQueryDsl::first`, `async` + `await` works, and it must be used otherwise the closure for `and_then` +// will both own `conn` and return a future that references it. #[async_trait] pub trait Crud<'a> where