Back when I made some slice indexing use unsafe, the compiler wasn't able to elide the bound checks on its own. However, when I made utf8_iter and pasted code into Compiler Explorer, I noticed that the compiler had learned to elide the bound checks.
Experiment with which instances of unsafe manual bound check elision would now work as safe code without a performance penalty.
Back when I made some slice indexing use
unsafe, the compiler wasn't able to elide the bound checks on its own. However, when I madeutf8_iterand pasted code into Compiler Explorer, I noticed that the compiler had learned to elide the bound checks.Experiment with which instances of
unsafemanual bound check elision would now work as safe code without a performance penalty.