-
-
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
[Merged by Bors] - implement TypeUuid
for primitives and fix multiple-parameter generics having the same TypeUuid
#6633
Conversation
Generic types should not have a single static UUID. |
…ge parsing of uuid from hex to string
I'm pretty sure they don't, this macro generates the same code as the derive, where a generic type's UUID will be a composite of their own uuid and their parameter's uuid. |
does anyone know why compilation sometimes fails due to the |
It's because |
Can you implement |
I think it can be implemented for |
On the topic of handling arrays, do we handle tuples as well? If not, that might need to be added for completeness (up to twelve fields to match |
TypeUuid
for primitivesTypeUuid
for primitives and fix multiple-parameter generics having the TypeUuid
TypeUuid
for primitives and fix multiple-parameter generics having the TypeUuid
TypeUuid
for primitives and fix multiple-parameter generics having the same TypeUuid
I've had to move the |
the name |
well the only reason it needs to be in a separate crate is that it's a proc macro. I could move it as a sub-crate of |
@alice-i-cecile - can you provide some guidance here? |
i don't think it's correct to put |
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.
LGTM!
considering the all_tuples!
move this should have C-Breaking-Change
.
Is |
https://docs.rs/bevy/latest/bevy/ecs/macro.all_tuples.html Apparently yes, although it has no docs. |
@dis-da-moe can you please rebase? This is worth including in the release. |
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.
Looks good! I think we should follow up by adding this trait on the types in the glam
and rect
modules as well
bors r+ |
…cs having the same `TypeUuid` (#6633) # Objective - Fixes #5432 - Fixes #6680 ## Solution - move code responsible for generating the `impl TypeUuid` from `type_uuid_derive` into a new function, `gen_impl_type_uuid`. - this allows the new proc macro, `impl_type_uuid`, to call the code for generation. - added struct `TypeUuidDef` and implemented `syn::Parse` to allow parsing of the input for the new macro. - finally, used the new macro `impl_type_uuid` to implement `TypeUuid` for the standard library (in `crates/bevy_reflect/src/type_uuid_impl.rs`). - fixes #6680 by doing a wrapping add of the param's index to its `TYPE_UUID` Co-authored-by: dis-da-moe <[email protected]>
Pull request successfully merged into main. Build succeeded:
|
TypeUuid
for primitives and fix multiple-parameter generics having the same TypeUuid
TypeUuid
for primitives and fix multiple-parameter generics having the same TypeUuid
…cs having the same `TypeUuid` (bevyengine#6633) # Objective - Fixes bevyengine#5432 - Fixes bevyengine#6680 ## Solution - move code responsible for generating the `impl TypeUuid` from `type_uuid_derive` into a new function, `gen_impl_type_uuid`. - this allows the new proc macro, `impl_type_uuid`, to call the code for generation. - added struct `TypeUuidDef` and implemented `syn::Parse` to allow parsing of the input for the new macro. - finally, used the new macro `impl_type_uuid` to implement `TypeUuid` for the standard library (in `crates/bevy_reflect/src/type_uuid_impl.rs`). - fixes bevyengine#6680 by doing a wrapping add of the param's index to its `TYPE_UUID` Co-authored-by: dis-da-moe <[email protected]>
# Objective `cargo run -p ci` is currently failing locally for me. ``` error: variables can be used directly in the `format!` string --> crates/bevy_reflect/bevy_reflect_derive/src/type_uuid.rs:106:69 | 106 | let uuid = Uuid::parse_str(&uuid).map_err(|err| input.error(format!("{}", err)))?; ``` It's not clear to me why CI/clippy didn't pick this up in #6633.
Objective
#[derive(TypeUuid)]
does not work with primitives in generics #5432TypeUuid
#6680Solution
impl TypeUuid
fromtype_uuid_derive
into a new function,gen_impl_type_uuid
.impl_type_uuid
, to call the code for generation.TypeUuidDef
and implementedsyn::Parse
to allow parsing of the input for the new macro.impl_type_uuid
to implementTypeUuid
for the standard library (incrates/bevy_reflect/src/type_uuid_impl.rs
).TypeUuid
#6680 by doing a wrapping add of the param's index to itsTYPE_UUID