Currently, all errors originating from the signatures of exported methods are spanned at the #[gdnative::methods] attribute. This makes it tricky to find the errors in cases where:
The owner type is wrong (or maybe missing?)
An argument type isn't FromVariant.
Currently, the errors look like:
error[E0308]: mismatched types
--> examples/dodge_the_creeps/src/hud.rs:11:1
|
11 | #[methods]
| ^^^^^^^^^^ expected struct `gdnative::gdnative_bindings::CanvasLayer`, found `&gdnative::gdnative_bindings::CanvasLayer`
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `gdnative::gdnative_bindings::PhysicsBody2D: gdnative::FromVariant` is not satisfied
--> examples/dodge_the_creeps/src/player.rs:17:1
|
17 | #[methods]
| ^^^^^^^^^^ the trait `gdnative::FromVariant` is not implemented for `gdnative::gdnative_bindings::PhysicsBody2D`
|
= note: required by `gdnative::FromVariant::from_variant`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
We might have to reimplement godot_wrap_method as procedural macro for the errors to be properly spanned.
This is partially improved in #443 and the errors point at individual method names now. It's still not ideal, but is a big improvement over the original situation.
Currently, all errors originating from the signatures of exported methods are spanned at the
#[gdnative::methods]
attribute. This makes it tricky to find the errors in cases where:owner
type is wrong (or maybe missing?)FromVariant
.Currently, the errors look like:
We might have to reimplement
godot_wrap_method
as procedural macro for the errors to be properly spanned.