Skip to content

Commit b97658a

Browse files
committed
Don't capture self in TableIter<'a, ...>::iter()
Due to the changes to capture logic in rust 2024 when returning `impl TYPE`, the result of `TableIter::iter()` currently captures an immutable reference to `&self`. Thus, one cannot mutably use a `TableIter` while the results of `TableIter::iter()` are being held. Use precise capturing on `TableIter::iter()` to allow the mutable use of `TableIter` while the result of `TableIter::iter()` is being held. See: https://blog.rust-lang.org/2024/09/05/impl-trait-capture-rules
1 parent e7464a8 commit b97658a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

flecs_ecs/src/core/table/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ where
9292
/// });
9393
/// ```
9494
#[inline(always)]
95-
pub fn iter(&self) -> impl ExactSizeIterator<Item = FieldIndex> {
95+
pub fn iter(&self) -> impl ExactSizeIterator<Item = FieldIndex> + use<IS_RUN, P> {
9696
// Range has no bounds checks, .map(FieldIndex) is inlined out to a single `add+load`
9797
(0..self.count).map(FieldIndex)
9898
}

0 commit comments

Comments
 (0)