bevy/crates/bevy_ecs/src
Zachary Harrold cbc931723e
Remove lifetime from QueryEntityError (#18157)
# Objective

- Allow `Query` methods such as `Query::get` to have their error
short-circuited using `?` in systems using Bevy's `Error` type

## Solution

- Removed `UnsafeWorldCell<'w>` from `QueryEntityError` and instead
store `ArchetypeId` (the information the error formatter was extracting
anyway).
- Replaced trait implementations with derives now that the type is
plain-old-data.

## Testing

- CI

---

## Migration Guide

- `QueryEntityError::QueryDoesNotMatch.1` is of type `ArchetypeId`
instead of `UnsafeWorldCell`. It is up to the caller to obtain an
`UnsafeWorldCell` now.
- `QueryEntityError` no longer has a lifetime parameter, remove it from
type signatures where required.

## Notes

This was discussed on Discord and accepted by Cart as the desirable path
forward in [this
message](https://discord.com/channels/691052431525675048/749335865876021248/1346611950527713310).
Scroll up from this point for context.

---------

Co-authored-by: SpecificProtagonist <30270112+SpecificProtagonist@users.noreply.github.com>
2025-03-09 20:05:22 +00:00
..
entity Add no_std support to bevy (#17955) 2025-03-07 03:39:46 +00:00
error BevyError: Bevy's new catch-all error type (#18144) 2025-03-07 01:50:07 +00:00
event Improve derive(Event) and simplify macro code (#18083) 2025-03-07 02:01:23 +00:00
identifier Harden proc macro path resolution and add integration tests. (#17330) 2025-02-09 19:45:45 +00:00
observer Improve derive(Event) and simplify macro code (#18083) 2025-03-07 02:01:23 +00:00
query Remove lifetime from QueryEntityError (#18157) 2025-03-09 20:05:22 +00:00
reflect Preserve spawned RelationshipTarget order and other improvements (#17858) 2025-03-05 22:18:57 +00:00
relationship Update Component docs to point to Relationship trait (#18179) 2025-03-07 23:32:43 +00:00
schedule BevyError: Bevy's new catch-all error type (#18144) 2025-03-07 01:50:07 +00:00
storage Handle TriggerTargets that are combinations for components/entities (#18024) 2025-02-24 23:57:34 +00:00
system Remove lifetime from QueryEntityError (#18157) 2025-03-09 20:05:22 +00:00
world Deprecate insert_or_spawn function family (#18147) 2025-03-06 17:04:16 +00:00
archetype.rs Move hashbrown and foldhash out of bevy_utils (#17460) 2025-01-23 16:46:08 +00:00
batching.rs Fix *most* clippy lints (#15906) 2024-10-14 20:52:35 +00:00
bundle.rs Preserve spawned RelationshipTarget order and other improvements (#17858) 2025-03-05 22:18:57 +00:00
change_detection.rs Make Query::single (and friends) return a Result (#18082) 2025-03-02 19:51:56 +00:00
component.rs Update Component docs to point to Relationship trait (#18179) 2025-03-07 23:32:43 +00:00
entity_disabling.rs Allow users to register their own disabling components / default query filters (#17768) 2025-02-11 18:25:32 +00:00
hierarchy.rs Update ChildOf deprecation advice to match new layout (#18089) 2025-02-28 23:15:23 +00:00
intern.rs Move hashbrown and foldhash out of bevy_utils (#17460) 2025-01-23 16:46:08 +00:00
label.rs do_not_recommend interned Labels (#17950) 2025-02-25 23:46:21 +00:00
lib.rs BevyError: Bevy's new catch-all error type (#18144) 2025-03-07 01:50:07 +00:00
name.rs Harden proc macro path resolution and add integration tests. (#17330) 2025-02-09 19:45:45 +00:00
removal_detection.rs Harden proc macro path resolution and add integration tests. (#17330) 2025-02-09 19:45:45 +00:00
resource.rs Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
spawn.rs Improved Spawn APIs and Bundle Effects (#17521) 2025-02-09 23:32:56 +00:00
traversal.rs Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00