-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Unable to use bevy_reflect derive macros when re-exported #1844
Comments
@alice-i-cecile, since I recently played with macroses in Bevy, I would like to take it. |
Sounds good @YohDeadfall! |
The While it's possible to create a macro rule to build a qualified path for the specified library and feed it unqualified names ( An alternative approach is to traverse dependencies of the crate upward which will work in some cases, but it won't take modules into account and, therefore, will produce incorrect code which is harder to fix manually as @TehPers did. |
I think that this could be solved using an attribute similar to serde's The main issue I'm having with this crate vs. the other bevy crates is that this crate uses // Import the bevy_ecs crate as bevy_ecs
use foo::bevy::{ ecs as bevy_ecs, prelude::* };
// implements bevy_ecs::bundle::Bundle
#[derive(Bundle)]
struct MyBundle {
component: MyComponent,
} If I were instead to derive |
Changing the path to |
…1875) Fixes bevyengine#1844 Co-authored-by: Carter Anderson <[email protected]>
Bevy version
0.5.0
Operating system & version
Windows 10
What you did
bevy = "0.5.0"
cargo expand
reveals that the macro is implementingcrate::TypeUuid
and usingcrate::Uuid
, which should not exist (exceptTypeUuid
if you're doing this in your crate root, but in any other module it shouldn't exist).What you expected to happen
Derive macro should have attempted to implement
bevy_reflect::TypeUuid
, or there should have been a way to customize the crate path.What actually happened
Running
cargo expand
reveals that the macro is implementingcrate::TypeUuid
, which does not exist.Additional information
By re-exporting
TypeUuid
andUuid
in the crate root, it's possible to make this still compile. While I can do that with my project, it seems like a workaround rather than a solution to the problem. I think that an attribute to specify where thebevy_reflect
crate is at would help solve this issue.The text was updated successfully, but these errors were encountered: