-
-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#[export]
fails to compile for Gd
types
#197
Comments
Gd
types#[export]
fails to compile for Gd
types
I was aware of this while writing the code, but thanks for reporting because now we have a good place to discuss it :) The autogenerated getters cannot move out of the field, so they need some way to create a copy of the value. For types that implement Note that derive macro doesn't know the type of the field, only the type's path name in the current scope. In particular, it cannot know whether The standard Rust way to do that is, of course, the The objection to implementing The two other types that act as references are The alternative to Because trait specialization is not yet stable, |
Great writeup!
I think that's the key takeaway. One way to see Apart from that, we're not yet sure if |
I sent a PR with the Having our own trait makes it a bit more controllable, perhaps? For example, |
(Relabeled as feature, because part of |
The following code fails to compile:
Using
#[export]
compiles fine for other types (e.g.int
) but when usingGd
the following error is provided:error[E0507]: cannot move out of
self.material
which is behind a shared reference--> src\example.rs:4:10
|
23 | #[derive(GodotClass)]
| ^^^^^^^^^^ move occurs because
self.material
has typegodot::prelude::Gd<Material>
, which does not implement theCopy
trait|
= note: this error originates in the derive macro
GodotClass
(in Nightly builds, run with -Z macro-backtrace for more info)The text was updated successfully, but these errors were encountered: