bevy/crates/bevy_ecs/src
0xc0001a2040 15be0d1a61
Add/fix track_caller attribute on panicking entity accessor methods (#8951)
# Objective

`World::entity`, `World::entity_mut` and `Commands::entity` should be
marked with `track_caller` to display where (in user code) the call with
the invalid `Entity` was made. `Commands::entity` already has the
attibute, but it does nothing due to the call to `unwrap_or_else`.

## Solution

- Apply the `track_caller` attribute to the `World::entity_mut` and
`World::entity`.
- Remove the call to `unwrap_or_else` which makes the `track_caller`
attribute useless (because `unwrap_or_else` is not `track_caller`
itself). The avoid eager evaluation of the panicking branch it is never
inlined.

---------

Co-authored-by: Giacomo Stevanato <giaco.stevanato@gmail.com>
2023-06-26 18:35:11 +00:00
..
entity Document every public item in bevy_ecs (#8731) 2023-06-10 23:23:48 +00:00
query Implement WorldQuery for EntityRef (#6960) 2023-06-22 21:20:00 +00:00
reflect Move AppTypeRegistry to bevy_ecs (#8901) 2023-06-21 17:25:01 +00:00
schedule Fix any_component_removed (#8939) 2023-06-23 17:08:47 +00:00
storage Document every public item in bevy_ecs (#8731) 2023-06-10 23:23:48 +00:00
system Add/fix track_caller attribute on panicking entity accessor methods (#8951) 2023-06-26 18:35:11 +00:00
world Add/fix track_caller attribute on panicking entity accessor methods (#8951) 2023-06-26 18:35:11 +00:00
archetype.rs Document every public item in bevy_ecs (#8731) 2023-06-10 23:23:48 +00:00
bundle.rs Document every public item in bevy_ecs (#8731) 2023-06-10 23:23:48 +00:00
change_detection.rs Allow unsized types as mapped value in Ref::map (#8817) 2023-06-12 17:52:11 +00:00
component.rs Simplify the ComponentIdFor type (#8845) 2023-06-15 12:57:47 +00:00
event.rs Document every public item in bevy_ecs (#8731) 2023-06-10 23:23:48 +00:00
lib.rs Implement WorldQuery for EntityRef (#6960) 2023-06-22 21:20:00 +00:00
removal_detection.rs Simplify the ComponentIdFor type (#8845) 2023-06-15 12:57:47 +00:00