From 6f7416adbfe982229ffada0ef85ae112d0c697b1 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 12 Jan 2026 17:52:50 +0000 Subject: [PATCH 1/2] Provide descriptive panic for Type::type_info Replace `unimplemented!()` with a detailed panic message explaining that `Any` driver does not support static type information, guiding users to use `query` instead of `query!` macros. --- sqlx-core/src/any/type.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sqlx-core/src/any/type.rs b/sqlx-core/src/any/type.rs index 1fc4dc53a3..61db5e14b8 100644 --- a/sqlx-core/src/any/type.rs +++ b/sqlx-core/src/any/type.rs @@ -8,8 +8,13 @@ macro_rules! impl_any_type { ($ty:ty) => { impl crate::types::Type for $ty { fn type_info() -> crate::any::AnyTypeInfo { - // FIXME: nicer panic explaining why this isn't possible - unimplemented!() + panic!( + "Type::type_info() is not implemented for Any \n\ + \n\ + This is because `Any` is a dynamic driver and does not support compile-time type verification. \n\ + \n\ + If you are using `query!` or `query_as!`, use `query` or `query_as` instead." + ); } fn compatible(ty: &crate::any::AnyTypeInfo) -> bool { From fd63924d7561c4d966583df54ffcb54c19abf7a8 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 12 Jan 2026 17:52:50 +0000 Subject: [PATCH 2/2] Provide descriptive panic for Type::type_info Replace `unimplemented!()` with a detailed panic message explaining that `Any` driver does not support static type information. Also included the name of the type for which `type_info` was called to aid debugging. --- sqlx-core/src/any/type.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sqlx-core/src/any/type.rs b/sqlx-core/src/any/type.rs index 61db5e14b8..a92d79f825 100644 --- a/sqlx-core/src/any/type.rs +++ b/sqlx-core/src/any/type.rs @@ -9,11 +9,8 @@ macro_rules! impl_any_type { impl crate::types::Type for $ty { fn type_info() -> crate::any::AnyTypeInfo { panic!( - "Type::type_info() is not implemented for Any \n\ - \n\ - This is because `Any` is a dynamic driver and does not support compile-time type verification. \n\ - \n\ - If you are using `query!` or `query_as!`, use `query` or `query_as` instead." + "Type::type_info() is not implemented for Any because it is a dynamic driver and does not support compile-time type verification. (for type `{}`)", + std::any::type_name::<$ty>(), ); }