From ff441ba7a0c9f68c14ae381470a0bf6464c35bc4 Mon Sep 17 00:00:00 2001 From: Fina Wilke Date: Wed, 23 Oct 2024 15:16:34 +0200 Subject: [PATCH] glib: Add unimplemented diagnostic to IsA linking to the wrapper macro --- glib/src/object.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/glib/src/object.rs b/glib/src/object.rs index 7b468deb3e4e..b72134d2e180 100644 --- a/glib/src/object.rs +++ b/glib/src/object.rs @@ -63,6 +63,11 @@ pub unsafe trait ObjectType: /// /// The trait can only be implemented if the appropriate `ToGlibPtr` /// implementations exist. +#[diagnostic::on_unimplemented( + message = "the trait `glib::object::IsA<{T}>` is not implemented for `{Self}`", + label = "requires `{Self}` to be a GObject that can be statically cast to `{T}`", + note = "if this is your own object, use the `glib::wrapper!` macro to implement this trait: https://gtk-rs.org/gtk-rs-core/stable/latest/docs/glib/macro.wrapper.html" +)] pub unsafe trait IsA: ObjectType + Into + AsRef + std::borrow::Borrow {