Return Result when creating a contiguous iterator#24181
Merged
alice-i-cecile merged 1 commit intobevyengine:mainfrom May 8, 2026
Merged
Return Result when creating a contiguous iterator#24181alice-i-cecile merged 1 commit intobevyengine:mainfrom
Result when creating a contiguous iterator#24181alice-i-cecile merged 1 commit intobevyengine:mainfrom
Conversation
alice-i-cecile
approved these changes
May 8, 2026
alice-i-cecile
added a commit
to alice-i-cecile/bevy
that referenced
this pull request
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
When
contiguous_iter{,_mut}was introduced in #21984, the API returns anOption<T>value. AResult<T, E>value should be a more natural choice for this type of fallible API.This also has the ergonomic benefit of being able to use the
?operator in fallible systems.Solution
Change it so that
contiguous_iter{,_mut}returns aResult<_, QueryNotDenseError>.Testing
Did you test these changes? If so, how?
I tried to run the tests, but I got the following error:
My changes are fairly minimal, so I can't imagine that this was caused by my PR. But I'll have to run the test directly on the CI for now, if you guys don't mind.
How can other people (reviewers) test your changes? Is there anything specific they need to know?
cargo test -p bevy_ecs