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
juniper::object() macro generates a lambda that has access to the rest of the scope. This is unsafe since the user can access any symbol of the code when juniper::object() expands.
This is the code I am talking about:
Unsafe has a specific meaning in Rust, and is not appropriate here. This is not related to memory unsafety.
Also, there isn't anything in scope that you couldn't get access to by specifying it; just the executor and arguments. You can also request the executor, just like the context, by specifying it as an argument.
It is admittedly unclean though and unexpected to magically have variables in scope. I have wanted to rewrite it to a regular function definition before, and we will get around to that soon, hopefully. It's a relatively small change.
juniper::object()
macro generates a lambda that has access to the rest of the scope. This is unsafe since the user can access any symbol of the code whenjuniper::object()
expands.This is the code I am talking about:
juniper/juniper_codegen/src/impl_object.rs
Lines 198 to 203 in 1148c75
It would be better to define a
fn
and give it the needed arguments.The text was updated successfully, but these errors were encountered: