Skip to content

Conversation

@james7132
Copy link
Member

Objective

all_tuples panics when the start count is set to anything other than 0 or 1. Fix this bug.

Solution

Originally part of #2381, this PR fixes the slice indexing used by the proc macro.

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Feb 21, 2022
@james7132 james7132 added A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior C-Code-Quality A section of code that is hard to understand or change and removed S-Needs-Triage This issue needs to be labelled labels Feb 21, 2022
Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change in itself is fine, although the motivation is unclear. I don't think we want all_tuples to be part of our public API, and obviously no internal uses run into this case.

@james7132
Copy link
Member Author

james7132 commented Feb 21, 2022

Ran into it as a part of #2381, where it was explicitly used in a case where the start for the macro was set at 2 to avoid confusing duplicate cases in the API.

This has since been made into an ecosystem crate (bevy_system_graph) instead of being merged into bevy_ecs, which is now as an external consumer of the macro.

@DJMcNab
Copy link
Member

DJMcNab commented Feb 21, 2022

I just saw that all_tuples is re-exported at the root of bevy_ecs. I agree then that using it publicly is 'fair'. However, I don't think we should be exporting it; evidence in favour of that is that it has no docs.

Since it is useful outside of our internal use, all_tuples should probably be spun out into its own crate.

@mockersf
Copy link
Member

I just saw that all_tuples is re-exported at the root of bevy_ecs. I agree then that using it publicly is 'fair'. However, I don't think we should be exporting it; evidence in favour of that is that it has no docs.

The macro is used in bevy_render so it has to be public...

@cart
Copy link
Member

cart commented Feb 21, 2022

bors r+

@cart
Copy link
Member

cart commented Feb 21, 2022

My preference is that we leave this public and move it to bevy_utils. I don't think it deserves its own crate.

bors bot pushed a commit that referenced this pull request Feb 21, 2022
# Objective
`all_tuples` panics when the start count is set to anything other than 0 or 1. Fix this bug.

## Solution
Originally part of #2381, this PR fixes the slice indexing used by the proc macro.
@bors bors bot changed the title Fix all_tuples macro for non-0/1 starts [Merged by Bors] - Fix all_tuples macro for non-0/1 starts Feb 22, 2022
@bors bors bot closed this Feb 22, 2022
kurtkuehnert pushed a commit to kurtkuehnert/bevy that referenced this pull request Mar 6, 2022
# Objective
`all_tuples` panics when the start count is set to anything other than 0 or 1. Fix this bug.

## Solution
Originally part of bevyengine#2381, this PR fixes the slice indexing used by the proc macro.
@james7132 james7132 deleted the all-tuples-fix branch March 21, 2022 01:37
@james7132 james7132 restored the all-tuples-fix branch June 22, 2022 08:26
@james7132 james7132 deleted the all-tuples-fix branch November 18, 2022 04:17
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-Bug An unexpected or incorrect behavior C-Code-Quality A section of code that is hard to understand or change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants