-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Reflect proc-macro causes compile errors when using custom Result type #3004
Comments
Could you provide a code sample to reproduce the issue? If you identified the root cause, a PR would be nice 🙂 |
@kyunghoon Do you have a code example that maintainers can use to reproduce the issue? |
Sounds like this is due to the proc macro not specifying the fully qualified path to |
I would like to solve this issue. But being new to Rust and this codebase, I wanted to clarify a few things:
|
Awesome! Glad to have you on board! Contributing to something like Bevy is a great way to learn Rust, honestly. Feel free to shoot a message on Discord (#engine-dev or #reflection-dev are good places to start) if you need help. I'd recommend maybe getting some feedback there first. I imagine there might be people opposed to this change as it adds verbosity for something that people "generally shouldn't do" like shadow the name of a type in Rust's prelude.
Yep! Anywhere we generate code, we should probably be using the fully-qualified path, which is most often in the For example, you would change
Possibly. It might be better to break things up as messing with a bunch of crates generally requires a lot more review. Maybe just start with
They were chosen because they were the first ones to come to mind :) But yes, that list is not exhaustive. |
# Objective - Fixes bevyengine#3004 ## Solution - Replaced all the types with their fully quallified names - Replaced all trait methods and inherent methods on dyn traits with their fully qualified names - Made a new file `fq_std.rs` that contains structs corresponding to commonly used Structs and Traits from `std`. These structs are replaced by their respective fully qualified names when used inside `quote!`
# Objective - Fixes bevyengine#3004 ## Solution - Replaced all the types with their fully quallified names - Replaced all trait methods and inherent methods on dyn traits with their fully qualified names - Made a new file `fq_std.rs` that contains structs corresponding to commonly used Structs and Traits from `std`. These structs are replaced by their respective fully qualified names when used inside `quote!`
# Objective - Fixes bevyengine#3004 ## Solution - Replaced all the types with their fully quallified names - Replaced all trait methods and inherent methods on dyn traits with their fully qualified names - Made a new file `fq_std.rs` that contains structs corresponding to commonly used Structs and Traits from `std`. These structs are replaced by their respective fully qualified names when used inside `quote!`
Bevy version
v0.5.0
Operating system & version
MacOS 11.4
What you did
used the Reflect proc-macro
What you expected to happen
compile successfully
What actually happened
compile error, conflicting Result types
Additional information
the
derive_reflect
process macro is not hygienic, i prefer to use my own specialized Result type which only has one generic parameter. this macro mistakenly picks it up. fix is pretty easy, i could make a PR if quested.The text was updated successfully, but these errors were encountered: