vec: make the move iterator fast for all types

Closes #10976

Taken from https://github.com/thestinger/rust-core/commit/863fbaaa125f1bb290e28cbf22236406cf0aebcf, so it will be easily updated to the better vector representation too.