Return `Result` when creating a contiguous iterator (#24181)
# Objective
When `contiguous_iter{,_mut}` was introduced in
https://github.com/bevyengine/bevy/pull/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:
```rust
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` M
musjj committed
e903ce1a9c7d7008bab4fa3fbbeea298bae12e1b
Parent: 90a282a
Committed by GitHub <noreply@github.com>
on 5/8/2026, 12:39:59 AM