#cryptic error when trying to derive reflect
35 messages · Page 1 of 1 (latest)
I'm not entirely sure, but I think that Reflect needs static lifetimes, which might be the problem, since I see some lifetime stuff?
i think those are for the macro's internals, my structures only contain owned values
Could you share the definitions for the other types in the variants?
And if you have the time, running cargo expand and replacing the derive with the output should point to exactly where in the output we’re hitting the error
I mean the error message does say that the problem is on column 35, which is the same as the Reflect derive, and also while not impossible, it would be hard for a compile time error to sneak into the bevy code.
If you could show the rest of the relevant code, it would be easier to debug (Only if you want to share it tho :D)
it's not confidential or anything, but it's distributed across different modules so it's hard to show the full thing
I'll try
expanding it gave me this
Are you one the main branch?
Oohhhh
it's not even a bevy error
just regular rust
The function you are implementing uses &mut self, but you are trying to return the value of self.0, which may not always be valid since &mut self only lasts for the function scope without a lifteime
depending on what value is you could maybe just clone it?
ooohh welp
I would try to change to stable and if that doesn't work, then maybe open an issue on the bevy github?
i'll try updating my toolchain
this is my current one
if anyone wanna try and debug this, i can share the repo
If stable doesn't work I think you should open an issue and share a copy of the code. If you want you could also try doing a minimal reproduction project?
it compiles juts fine on stable 😓
Are you using nightly for something specific?
not for this project atm
so i guess this issue could be considered resolved
Weird. I wonder if this is a nightly bug since the code should compile afaict
We’re not changing the lifetime at all and it’s taking not actually using *self
If you tried manually implementing a method on your enum exactly like that one, does it produce the same error?
i just expanded and pasted that in
i could try that tomorrow if you think that would help narrow it down