diff --git a/src/core/db.rs b/src/core/db.rs index d915c8c..6f6344d 100644 --- a/src/core/db.rs +++ b/src/core/db.rs @@ -55,6 +55,13 @@ const MIGRATIONS: &[(&str, &str)] = &[ ]; pub fn create_connection(db_path: &Path) -> Result { + // SAFETY: `sqlite3_vec_init` is an extern "C" function provided by the sqlite-vec + // crate with the exact signature expected by `sqlite3_auto_extension`. The transmute + // converts the concrete function pointer to the `Option` type + // that the FFI expects. This is safe because: + // 1. The function is a C-ABI init callback with a stable signature. + // 2. SQLite calls it once per new connection, matching sqlite-vec's contract. + // 3. `sqlite3_auto_extension` is idempotent for the same function pointer. #[allow(clippy::missing_transmute_annotations)] unsafe { rusqlite::ffi::sqlite3_auto_extension(Some(std::mem::transmute(