Open
Description
I have found these related issues/pull requests
#3195 seems to mention this issue, but in a different context.
Description
This codegen snippet omits generic types when generating the sqlx::Type
impl:
sqlx/sqlx-macros-core/src/derives/type.rs
Lines 244 to 263 in 9079720
The same file contains a valid codegen logic just above the previously mentioned code fragment:
sqlx/sqlx-macros-core/src/derives/type.rs
Lines 87 to 110 in 9079720
Reproduction steps
- Create a struct with a generic type
- Derive
sqlx::Type
for it - Enable
postgres
-related features in sqlx
This should result in an error similar to this one:
error[E0107]: missing generics for struct `Test`
--> [snip]
|
118 | pub struct Test<OC: Serialize + DeserializeOwned + 'static> {
| ^^^^ expected 1 generic argument
|
note: struct defined here, with 1 generic parameter: `OC`
--> [snip]
|
118 | pub struct Test<OC: Serialize + DeserializeOwned + 'static> {
| ^^^^ --
help: add missing generic argument
|
118 | pub struct Test<OC><OC: Serialize + DeserializeOwned + 'static> {
| ++++
SQLx version
0.8.6
Enabled SQLx features
runtime-tokio-native-tls,postgres,chrono,json,macros,migrate,uuid
Database server and version
Postgres 16.9
Operating system
NixOS 25.05
Rust version
rustc 1.87.0 (17067e9ac 2025-05-09)