You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@tsoutsman this happens due to declared methods not being actual real Rust methods, but something artificial, which is desugared into in-place code block.
On the latest master this has been fixed already in #971.
Describe the bug
The self parameter is not required in resolvers, even if they use self.
This isn't a bug per se, but it leads to some pretty confusing code, so I don't think it should be allowed.
To Reproduce
The following compiles:
Expected behaviour
Compilation failure.
Additional context
This happens because of how the
graphql_object
macro transforms the resolvers.Using
cargo expand
, the example above expands to:Click to see full output
The important part is:
In particular
let res: &str = (|| self.name.as_ref())();
grabs self from the surrounding context.The text was updated successfully, but these errors were encountered: