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 expansion of sqlx(flatten) #2023

Merged
merged 1 commit into from Sep 3, 2022

Conversation

RustyYato
Copy link
Contributor

Given a generic type like A<B> before sqlx would produce
A<B>::from_row(row) which is invalid syntax.
Now it produces <A<B> as ::sqlx::FromRow<'a, R>>.
This also fixes a bug for non-generic types where an inherent method
might have been called instead of the ::sqlx::FromRow::from_row method
because UFCS wasn't used.

Given a generic type like `A<B>` before `sqlx` would produce
`A<B>::from_row(row)` which is invalid syntax.
Now it produces `<A<B> as ::sqlx::FromRow<'a, R>>`.
This also fixes a bug for non-generic types where an inherent method
might have been called instead of the `::sqlx::FromRow::from_row` method
because UFCS wasn't used.
@RustyYato
Copy link
Contributor Author

I would also recommend not using a single letter generic parameter in macros because it will easily conflict with the users of the macro. (In this case I had a conflict with the chosen parameter name R). I can also update that if you think that's worthwhile to change.

@abonander
Copy link
Collaborator

I can also update that if you think that's worthwhile to change.

That sounds fine, yeah.

@abonander abonander merged commit c5f3513 into launchbadge:main Sep 3, 2022
@RustyYato RustyYato deleted the fix-from-row-derive branch September 10, 2022 14:30
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.

None yet

2 participants