From bf4c9524ce9bee7009ef7be6b4e4610a2545403a Mon Sep 17 00:00:00 2001 From: Alexander 'z33ky' Hirsch <1zeeky@gmail.com> Date: Mon, 14 Sep 2020 17:58:09 +0200 Subject: [PATCH] Make note about unwind-safety for SQLite custom functions in documentation --- diesel_derives/src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/diesel_derives/src/lib.rs b/diesel_derives/src/lib.rs index 7805f8bb0774..6c28ba04a197 100644 --- a/diesel_derives/src/lib.rs +++ b/diesel_derives/src/lib.rs @@ -906,6 +906,17 @@ pub fn derive_valid_grouping(input: TokenStream) -> TokenStream { /// # } /// ``` /// +/// ## Panics +/// +/// If an implementation of the custom function panics and unwinding is enabled, the panic is +/// caught and the function returns to libsqlite with an error. It cannot propagate the panics due +/// to the FFI bounary. +/// The function or closure is internally wrapped in an +/// [`AssertUnwindSafe`](std::panic::AssertUnwindSafe). Its implementation must take care of +/// unwind-safety to avoid logic bugs on panic. +/// +/// This also holds for [custom aggregate functions](#custom-aggregate-functions). +/// /// ## Custom Aggregate Functions /// /// Custom aggregate functions can be created in SQLite by adding an `#[aggregate]`