bevy/crates/bevy_ecs/src
SpecificProtagonist 5f1e114209
Descriptive error message for circular required components recursion (#16648)
# Objective

Fixes #16645

## Solution

Keep track of components in callstack when registering required
components.

## Testing

Added a test checking that the error fires.

---

## Showcase

```rust
#[derive(Component, Default)]
#[require(B)]
struct A;

#[derive(Component, Default)]
#[require(A)]
struct B;
World::new().spawn(A);
```

```
thread 'main' panicked at /home/vj/workspace/rust/bevy/crates/bevy_ecs/src/component.rs:415:13:
Recursive required components detected: A → B → A
```

---------

Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com>
2024-12-11 01:26:35 +00:00
..
entity Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
event Window picking (#16103) 2024-12-05 21:14:39 +00:00
identifier Use en-us locale for typos (#16037) 2024-10-20 18:55:17 +00:00
observer Rename trigger.entity() to trigger.target() (#16716) 2024-12-08 21:55:09 +00:00
query Deny derive_more error feature and replace it with thiserror (#16684) 2024-12-06 17:03:55 +00:00
reflect Add Immutable Component Support (#16372) 2024-12-05 14:27:48 +00:00
schedule Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
storage ✏️ Fix typos across bevy (#16702) 2024-12-08 01:18:39 +00:00
system one shot system cleanup (#16516) 2024-12-10 17:59:42 +00:00
world Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
archetype.rs Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
batching.rs Fix *most* clippy lints (#15906) 2024-10-14 20:52:35 +00:00
bundle.rs Descriptive error message for circular required components recursion (#16648) 2024-12-11 01:26:35 +00:00
change_detection.rs Migrate from Query::single and friends to Single (#15872) 2024-10-13 20:32:06 +00:00
component.rs Descriptive error message for circular required components recursion (#16648) 2024-12-11 01:26:35 +00:00
intern.rs Update hashbrown to 0.15 (#15801) 2024-12-10 19:45:50 +00:00
label.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
lib.rs Descriptive error message for circular required components recursion (#16648) 2024-12-11 01:26:35 +00:00
removal_detection.rs fix: add reflect to SceneInstanceReady and other observers/events (#16018) 2024-10-20 13:51:41 +00:00
result.rs Fallible systems (#16589) 2024-12-05 22:29:06 +00:00
traversal.rs Window picking (#16103) 2024-12-05 21:14:39 +00:00