-
Notifications
You must be signed in to change notification settings - Fork 426
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
Use fully qualified path to types in generated code #1195
Conversation
Looking at this again there are many other cases that could fail in the same way ( |
quote! { | ||
.deprecated(::std::option::Option::#reason) | ||
.deprecated(#reason) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This worked before but I changed it to make it more clear that the types are correctly qualified. I spent quite a while trying to track down an expected identifier, found ::
error caused by the doubly qualified path (::std::option::Option::std::option::Option::Some(...)
after only changing the other line.
Happy to revert if preferred.
ed0fab9
to
d78604a
Compare
The preference would be core over std where possible. Last I looked we still build on no_std. |
Does that include using the derived code? There are several instances of things like I will update the changes in this PR to use core though. Should existing references to |
If user code has a type alias (or custom type) called `Result` or `Option` etc, this would be used instead of the intended standard library types causing surprising compile errors from generated code. Using the fully qualified path allows the generated code to be isolated from user types. Includes two basic regression tests covering `Result` and `Send`. Fixes graphql-rust#1194
d78604a
to
d3cd490
Compare
Sorry, I was mistaken...I got my wires crossed with wasm |
Awesome, thanks! |
If user code has a type alias (or custom type) called
Result
orOption
etc,this would be used instead of the intended standard library types causing
surprising compile errors from generated code.
Using the fully qualified path allows the generated code to be isolated
from user types.
Fixes #1194