sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

Remove unnecessary boxfutures

Open joeydewaal opened this issue 1 year ago • 4 comments

This is a breaking change

This pr removes unnecessary BoxFuture's in trait definitions Connection, MigrateDatabase, TransactionManager, ConnectOptions, TestSupport and PgPoolCopyExt.

I was not able to make these changes to the Executor and Acquire traits unfortunately because of a rustc limitation.

error: lifetime bound not satisfied
   |
38 | /     async fn fetch_optional<'e, 'q: 'e, E>(
39 | |         self,
40 | |         query: E,
41 | |     ) -> Result<Option<DB::Row>, Error>
42 | |     where
43 | |         E: 'q + Execute<'q, Self::Database>,
   | |____________________________________________^
   |
   = note: this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)

joeydewaal avatar Sep 26 '24 09:09 joeydewaal

It seems like the stack is overflowing in debug mode, in release mode the tests pass.

joeydewaal avatar Sep 26 '24 10:09 joeydewaal

We probably need to do the same thing to PgConnection as was done to MySqlConnection and wrap the fields in a Box, then it'll be less to pass around.

abonander avatar Sep 28 '24 03:09 abonander

The Executor and Acquire traits likely require reworking anyway. I'll get to that at some point soon.

abonander avatar Sep 28 '24 03:09 abonander

We probably need to do the same thing to PgConnection as was done to MySqlConnection and wrap the fields in a Box, then it'll be less to pass around.

I opened a new pr for this (#3529)

joeydewaal avatar Sep 28 '24 14:09 joeydewaal