bevy/crates/bevy_ecs/src
Luca Della Vedova 6d3b2faf8a
Fix commands not being Send / Sync in 0.14 (#14392)
# Objective

Fixes Commands not being `Send` or `Sync` anymore in 0.14 by
implementing `Send` and `Sync` for `RawCommandQueue`.

## Solution

Reference discussion in
[discord](https://discord.com/channels/691052431525675048/691052431974465548/1259464518539411570).
It seems that in https://github.com/bevyengine/bevy/pull/13249, when
adding a `RawCommandQueue` variant to the `InternalQueue`, the `Send /
Sync` traits were not implemented for it, which bubbled up all the way
to `Commands` not being `Send / Sync` anymore.
I am not very familiar with the ECS internals so I can't say whether the
`RawCommandQueue` is safe to be shared between threads, but I know for
sure that before the linked PR `Commands` were indeed `Send` and `Sync`
so that PR broke "some workflows" (mandatory
[xkcd](https://xkcd.com/1172/)).

## Testing

This PR itself includes a compile test to make sure `Commands` will
implement `Send` and `Sync`. The test itself fails without the
implementation and succeeds with it.
Furthermore, if I cherry pick the test to a previous release (i.e. 0.13)
it indeed succeeds, showing that this is a regression specific to 0.14.

---------

Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
2024-08-19 21:29:30 +00:00
..
entity Fix Entity Debug Format (#14539) 2024-07-31 01:36:41 +00:00
event Minimal Bubbling Observers (#13991) 2024-07-15 13:39:41 +00:00
identifier feat: Reflection implementations on Identifier (#13648) 2024-06-03 16:33:14 +00:00
observer document using ObserverState as filter for Observer Entitys (#14669) 2024-08-12 16:07:03 +00:00
query Add query reborrowing (#14690) 2024-08-15 17:38:56 +00:00
reflect Use map_unchanged in reflection instead of creating a Mut manually. (#14692) 2024-08-15 14:26:57 +00:00
schedule Use #[doc(fake_variadic)] to improve docs readability (#14703) 2024-08-12 18:54:33 +00:00
storage feat: add insert_if_new (#14397) (#14646) 2024-08-15 20:31:41 +00:00
system Fix commands not being Send / Sync in 0.14 (#14392) 2024-08-19 21:29:30 +00:00
world feat: add insert_if_new (#14397) (#14646) 2024-08-15 20:31:41 +00:00
archetype.rs feat: add insert_if_new (#14397) (#14646) 2024-08-15 20:31:41 +00:00
batching.rs Parallel event reader (#12554) 2024-04-22 16:37:42 +00:00
bundle.rs feat: add insert_if_new (#14397) (#14646) 2024-08-15 20:31:41 +00:00
change_detection.rs Track source location in change detection (#14034) 2024-07-30 12:02:38 +00:00
component.rs Component Lifecycle Hook & Observer Trigger for replaced values (#14212) 2024-07-15 15:24:15 +00:00
intern.rs Moves intern and label modules into bevy_ecs (#12772) 2024-04-08 15:34:11 +00:00
label.rs Add mappings to EntityMapper (#13727) 2024-06-08 12:52:23 +00:00
lib.rs Add Command and co. to prelude (#14751) 2024-08-15 13:33:32 +00:00
removal_detection.rs Created an EventMutator for when you want to mutate an event before reading (#13818) 2024-07-08 14:53:06 +00:00
traversal.rs Minimal Bubbling Observers (#13991) 2024-07-15 13:39:41 +00:00