Skip to content

Conversation

Trashtalk217
Copy link
Contributor

@Trashtalk217 Trashtalk217 commented Oct 18, 2025

Objective

Multiple tests derive both Resource and Component on a single struct. In the current resources-for-components plan (#19731), this leads to a conflict.

Solution

#[derive(Resource, Component)]
struct A;

Becomes

#[derive(Component)]
struct A;

#[derive(Resource)]
struct ResA;

and the tests are changed accordingly.

There was one test that had to be removed as it specifically tested that a query could both query a resource and a component with the same name. That test doesn't make any sense anymore, so I removed it.

Testing

I tested the changes by adding code into Resource derive macro, that also derives Component, so any conflicts showed up by running cargo build.

Future work

AmbientLight in bevy_light still derives both, but since that requires a little more work, I'm saving it for later.

@Trashtalk217 Trashtalk217 added D-Trivial Nice and easy! A great choice to get started with Bevy A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change C-Testing A change that impacts how we test Bevy or how users test their apps S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 18, 2025
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 19, 2025
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Oct 19, 2025
Merged via the queue into bevyengine:main with commit 17ba0fd Oct 19, 2025
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change C-Testing A change that impacts how we test Bevy or how users test their apps D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants