Skip to content

fix: relax Clone bound on Pool<DB>#14

Merged
jdrouet merged 2 commits intomainfrom
fix/pool-clone-bound
Apr 26, 2026
Merged

fix: relax Clone bound on Pool<DB>#14
jdrouet merged 2 commits intomainfrom
fix/pool-clone-bound

Conversation

@jdrouet
Copy link
Copy Markdown
Owner

@jdrouet jdrouet commented Apr 26, 2026

Summary

  • Replace #[derive(Clone)] on Pool<DB> with a manual impl, dropping the spurious DB: Clone bound (sqlx database markers like Postgres/Sqlite don't implement Clone, but sqlx::Pool<DB> itself does).
  • Add compile-time assert_clone checks for Pool<Postgres> and Pool<Sqlite> to lock in the contract.

Alternative to #6, addressing review feedback: drops the unrelated inner.into() change, keeps self.attributes.clone() for consistency with the rest of the file, and mirrors the test on the sqlite side. No version bump, leave that to the next release.

@jdrouet jdrouet force-pushed the fix/pool-clone-bound branch from 393fe1e to 7270ecb Compare April 26, 2026 12:12
jdrouet added 2 commits April 26, 2026 14:18
The derived Clone implementation adds an implicit DB: Clone bound,
which breaks downstream code because sqlx database markers like
Postgres and Sqlite don't implement Clone. sqlx::Pool<DB> itself is
Clone regardless of DB, so a manual impl drops the spurious bound.

Adds compile-time assertions for Pool<Postgres> and Pool<Sqlite>.
@jdrouet jdrouet force-pushed the fix/pool-clone-bound branch from 7270ecb to f743f35 Compare April 26, 2026 12:18
@jdrouet jdrouet merged commit c7aaea7 into main Apr 26, 2026
5 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 26, 2026
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.

1 participant