4 ms·
You don't have to turn off subscript checking for simple loop iteration. As the article says, you're supposed to use .iter_mut() for this purpose where the unsa
by gliptic 12y ago
You don't have to turn off subscript checking for simple loop iteration. As the article says, you're supposed to use .iter_mut() for this purpose where the unsafe code is isolated to library code.
The passage you quoted is about splitting a slice in two, not loop iteration. Bounds-check elimination can't solve this problem, and once again it's about unsafe code encapsulated in libraries. The function split_at_mut is perfectly safe to use in safe code.