Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid where Self: 'a clause on GATs #106

Merged
merged 4 commits into from
Sep 8, 2023

Conversation

kmdreko
Copy link
Contributor

@kmdreko kmdreko commented Sep 5, 2023

This removes the where Self: 'a clauses on AsyncConnection's associated types. The compiler over-eagerly asserts the trait should have the constraint but it is flawed when handling transactions generically. Dummy _silence_lint_on_* functions were added to convince the compiler the constraints are not required.

Fixes: #104

Copy link
Owner

@weiznich weiznich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in favor of this change, but I would like to add some more documentation to the workaround so that we don't wonder why this was done.

@@ -341,4 +333,10 @@ pub trait AsyncConnection: SimpleAsyncConnection + Sized + Send {
fn transaction_state(
&mut self,
) -> &mut <Self::TransactionManager as TransactionManager<Self>>::TransactionStateData;

#[doc(hidden)]
fn _silence_lint_on_execute_future(_: Self::ExecuteFuture<'_, '_>) {}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment to these function explaining why they exist + linking to the relevant rust issues?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment and link added

Copy link
Owner

@weiznich weiznich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@weiznich weiznich merged commit e3c3511 into weiznich:main Sep 8, 2023
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiler requires 'static when using transactions on generic AsyncConnection
2 participants