For-loop moves a mutable vector borrow

This is a subtle difference between moving a mutable borrow (what's happening in for particle in particles vs reborrowing, which is what's happening in for particle in particles.iter_mut()). There was some recent discussion of this and @bluss gave a nice summary: What's the difference between 'for x in b' and 'for x in b.into_iter()'? - #4 by bluss.

1 Like