Skip to content

Commit

Permalink
glib: Add unimplemented diagnostic to IsA linking to the wrapper macro
Browse files Browse the repository at this point in the history
  • Loading branch information
felinira authored and bilelmoussaoui committed Oct 23, 2024
1 parent 865f49a commit ff441ba
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions glib/src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: ObjectType>:
ObjectType + Into<T> + AsRef<T> + std::borrow::Borrow<T>
{
Expand Down

0 comments on commit ff441ba

Please sign in to comment.