Open Aandreba opened 5 months ago
Though removing unnecessary boxing is always nice, I don't feel bumping the MSRV to 1.75 is worth the change. We would also really just swap async_trait
for trait_variant
(or do it by hand anyway). I say we wait until RPITIT is more mature and not discouraged by the async team.
We would also really just swap
async_trait
fortrait_variant
(or do it by hand anyway).
I don't think trait_variant
is required, because sqlx
requires the futures to be Send
anyways, so no need (and no possiblity either) to support both Send
and !Send
. This also means that the current limitation doesn't apply from what I understand.
See also the discussion in #3016
Re. MSRV, I'll remind readers of our official policy: https://github.com/launchbadge/sqlx/blob/main/FAQ.md#what-versions-of-rust-does-sqlx-support-what-is-sqlxs-msrv
If we do this refactor alongside #3016 it would have to be a major release anyway as that's a breaking change.
Given the recent stabilization of
async fn
and returnimpl Trait
in traits on Rust 1.75.0, perhaps it should be time to consider moving away from theasync_trait
crate.This would probably allow the compiler to optimize async blocks more easily, and would most likely result in a decrease in memory usage (given that
async_trait
boxes the futures returned by the trait functions). It would also mean one dependency less to maintain, which is always nice.Things to consider
If you see any other downsides (or benefits) to this change, please feel free to comment them.