This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new 9cd246e5f fix(rust/ffi)!: require `Send` for exported types (#4874)
9cd246e5f is described below

commit 9cd246e5f5a68da07b0215afdf72820fd1389f71
Author: David Li <[email protected]>
AuthorDate: Thu Oct 8 17:16:27 2026 -0700

    fix(rust/ffi)!: require `Send` for exported types (#4874)
    
    This matches the specification in the C header: handles aren't
    necessarily usable concurrently, but they can be used from different
    threads so long as access does not overlap.
    
    Assisted-by: GPT-6.1 Sol
---
 rust/ffi/src/driver_exporter.rs | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/rust/ffi/src/driver_exporter.rs b/rust/ffi/src/driver_exporter.rs
index 28ef7d3ed..2c775f718 100644
--- a/rust/ffi/src/driver_exporter.rs
+++ b/rust/ffi/src/driver_exporter.rs
@@ -116,7 +116,12 @@ pub trait FFIDriver {
     fn ffi_driver() -> FFI_AdbcDriver;
 }
 
-impl<DriverType: Driver + Default + 'static> FFIDriver for DriverType {
+impl<DriverType: Driver + Default + 'static> FFIDriver for DriverType
+where
+    DatabaseType<DriverType>: Send,
+    ConnectionType<DriverType>: Send,
+    StatementType<DriverType>: Send,
+{
     fn ffi_driver() -> FFI_AdbcDriver {
         FFI_AdbcDriver {
             private_data: std::ptr::null_mut(),
@@ -194,7 +199,10 @@ impl<DriverType: Driver + Default + 'static> FFIDriver for 
DriverType {
 ///     - `adbc_driver_sqlite.dll` -> `AdbcDriverSqliteInit`
 ///     - `proprietary_driver.dll` -> `AdbcProprietaryDriverInit`
 /// - `$driver_type` - Driver's type which must implement [Driver] and 
[Default].
-///   Currently, the Rust driver is exported as an ADBC 1.1.0 C driver.
+///   Database, connection, and statement types must implement [`Send`], since
+///   exported handles may be moved to another thread.
+///
+/// Currently, the Rust driver is exported as an ADBC 1.1.0 C driver.
 #[macro_export]
 macro_rules! export_driver {
     ($func_name:ident, $driver_type:ty) => {

Reply via email to