Skip to content

Ref::upcast should not require SafeAsRaw #1040

Open
@chitoyuu

Description

@chitoyuu

From DragonAxe via Discord:

So I thought I would try using Ref instead of Instance, but I'm running into this error:

   #[method]
   fn _ready(&self, #[base] owner: TRef<Label>) {
       CLIENT_STORE.with(|store| {
           let a = owner.claim().upcast::<Node>();
           store.my_sig.subscribe(a);
       });
   }
error[E0599]: the method `upcast` exists for struct `gdnative::prelude::Ref<Label>`, but its trait > bounds were not satisfied
   --> src/controls/connection_status_label.rs:21:35
    |
21  |             let a = owner.claim().upcast::<Node>();
    |                                   ^^^^^^ method cannot be called on `gdnative::prelude::Ref<Label>` due to unsatisfied trait bounds
    |
   ::: /home/dragonaxe/.cargo/registry/src/github.com-1ecc6299db9ec823/gdnative-core-0.11.2/src/object/bounds.rs:237:1
    |
237 | pub struct RefImplBound {
    | ----------------------- doesn't satisfy `RefImplBound: SafeAsRaw<ManuallyManaged, Shared>`
    |
    = note: the following trait bounds were not satisfied:
            `RefImplBound: SafeAsRaw<ManuallyManaged, Shared>`

Ref::upcast shouldn't require SafeAsRaw since it is statically determined and doesn't perform that action.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions