Compiler requires 'static
when using transactions on generic AsyncConnection
#104
Closed
3 tasks done
Labels
bug
Something isn't working
The following reproducible sample triggers a compiler error:
As far as I know, using
.transaction()
and.execute()
in this way should not require a'static
bound.I ended up investigating myself, created a StackOverflow post about it when I thought I was stuck, and ended up self-answering it as an odd interaction with GATs and
Self
-bounds.While this isn't a major roadblock for using diesel-async (since workarounds exist) it would be nice to avoid this problem. The solution is to avoid
where Self: 'conn
on the associated types ofAsyncConnection
. This can be done (though a bit of a hack) via a dummy function as shown in this comment. I was able to modify diesel-async with this change and tested it myself. It does fix the above error and I didn't see any conflicts or downsides.So let me know if that's worth a PR. Or if that doesn't sound worth it or would be problematic, that's fine too.
The text was updated successfully, but these errors were encountered: