diff --git a/diesel/src/sqlite/connection/serialized_database.rs b/diesel/src/sqlite/connection/serialized_database.rs index 8584d9109b09..28a98a286131 100644 --- a/diesel/src/sqlite/connection/serialized_database.rs +++ b/diesel/src/sqlite/connection/serialized_database.rs @@ -13,7 +13,10 @@ pub struct SerializedDatabase { impl SerializedDatabase { /// Creates a new `SerializedDatabase` with the given data pointer and length. - pub fn new(data: *mut u8, len: usize) -> Self { + /// + /// SAFETY: The data pointer needs to be returned by sqlite + /// and the length must match the underlying buffer pointer + pub(crate) unsafe fn new(data: *mut u8, len: usize) -> Self { Self { data, len } }