bevy/crates/bevy_reflect/bevy_reflect_derive/src
Gino Valente 5e5a305d43
bevy_reflect: Fix trailing comma breaking derives (#8014)
# Objective

Fixes #7989

Based on #7991 by @CoffeeVampir3

## Solution

There were three parts to this issue:
1. `extend_where_clause` did not account for the optionality of a where
clause's trailing comma
    ```rust
    // OKAY
    struct Foo<T> where T: Asset, {/* ... */}
    // ERROR
    struct Foo<T> where T: Asset {/* ... */}
    ```
2. `FromReflect` derive logic was not actively using
`extend_where_clause` which led to some inconsistencies (enums weren't
adding _any_ additional bounds even)
3. Using `extend_where_clause` in the `FromReflect` derive logic meant
we had to optionally add `Default` bounds to ignored fields iff the
entire item itself was not already `Default` (otherwise the definition
for `Handle<T>` wouldn't compile since `HandleType` doesn't impl
`Default` but `Handle<T>` itself does)

---

## Changelog

- Fixed issue where a missing trailing comma could break the reflection
derives
2023-03-27 21:47:33 +00:00
..
impls Follow up on Todo in bevy_reflect_derive (#7461) 2023-02-02 04:37:32 +00:00
container_attributes.rs Use a fixed state hasher in bevy_reflect for deterministic Reflect::reflect_hash() across processes (#7583) 2023-02-17 15:37:35 +00:00
derive_data.rs Enable deriving Reflect on structs with generic types (#7364) 2023-01-28 00:12:06 +00:00
documentation.rs Make proc macros hygienic in bevy_reflect_derive (#6752) 2022-12-05 23:39:44 +00:00
enum_utility.rs Fix minor typos in code and docs (#7378) 2023-01-27 12:12:53 +00:00
field_attributes.rs Fix some more typos (#7767) 2023-02-20 23:36:28 +00:00
fq_std.rs Enable deriving Reflect on structs with generic types (#7364) 2023-01-28 00:12:06 +00:00
from_reflect.rs bevy_reflect: Fix trailing comma breaking derives (#8014) 2023-03-27 21:47:33 +00:00
lib.rs bevy_reflect: Improved documentation (#7148) 2023-02-18 20:42:01 +00:00
reflect_value.rs bevy_reflect: Reflect doc comments (#6234) 2022-10-18 13:49:57 +00:00
registration.rs Enable deriving Reflect on structs with generic types (#7364) 2023-01-28 00:12:06 +00:00
trait_reflection.rs Fix beta clippy lints (#7154) 2023-01-11 09:51:22 +00:00
type_uuid.rs Fix clippy lint (#7765) 2023-02-20 22:56:58 +00:00
utility.rs bevy_reflect: Fix trailing comma breaking derives (#8014) 2023-03-27 21:47:33 +00:00