Skip to content

Return Result when creating a contiguous iterator#24181

Merged
alice-i-cecile merged 1 commit intobevyengine:mainfrom
musjj:contiguous-iter-error
May 8, 2026
Merged

Return Result when creating a contiguous iterator#24181
alice-i-cecile merged 1 commit intobevyengine:mainfrom
musjj:contiguous-iter-error

Conversation

@musjj
Copy link
Copy Markdown
Contributor

@musjj musjj commented May 8, 2026

Objective

When contiguous_iter{,_mut} was introduced in #21984, the API returns an Option<T> value. A Result<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 a Result<_, QueryNotDenseError>.

Testing

  • Did you test these changes? If so, how?

    I tried to run the tests, but I got the following error:

    fatal runtime error: failed to initiate panic, error 5, aborting
    error: test failed, to rerun pass `-p bevy_ecs --lib`

    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

@alice-i-cecile alice-i-cecile added this to the 0.19 milestone May 8, 2026
@alice-i-cecile alice-i-cecile added D-Trivial Nice and easy! A great choice to get started with Bevy A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels May 8, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in ECS May 8, 2026
@alice-i-cecile alice-i-cecile enabled auto-merge May 8, 2026 00:39
@alice-i-cecile alice-i-cecile added this pull request to the merge queue May 8, 2026
alice-i-cecile added a commit to alice-i-cecile/bevy that referenced this pull request May 8, 2026
Merged via the queue into bevyengine:main with commit e903ce1 May 8, 2026
47 checks passed
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in ECS May 8, 2026
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-Usability A targeted quality-of-life change that makes Bevy easier to use 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

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants