diff --git a/src/future_moves.rs b/src/future_moves.rs index d478919..eda815b 100644 --- a/src/future_moves.rs +++ b/src/future_moves.rs @@ -253,7 +253,7 @@ impl FutureMoves { // TODO! impl dynamic sorting based on children's states, maybe it propegates // upwards using the `parent` field // SAFETY! the sort_by_key function should not modify anything - unsafe { &mut *(self as *mut Self) }.arena[idx] + unsafe { (&mut *(self as *mut Self)).arena.get_unchecked_mut(idx) } .children // negative because we want the largest value in the first index .sort_by_key(|&x| -self.arena[x].value);