std::str: safen and optimize is_utf8.

This uses a vector iterator to avoid the necessity for unsafe indexing,
and makes this function slightly faster. Unfortunately #11751 means that
the iterator comes with repeated `null` checks which means the
pure-ASCII case still has room for significant improvement (and the
other cases too, but it's most significant for just ASCII).

Before:

    is_utf8_100_ascii             ... bench:       143 ns/iter (+/- 6)
    is_utf8_100_multibyte         ... bench:       134 ns/iter (+/- 4)

After:

    is_utf8_100_ascii             ... bench:       123 ns/iter (+/- 4)
    is_utf8_100_multibyte         ... bench:       115 ns/iter (+/- 5)
std: convert first_non_utf8_byte to use the iterator.

As far as I can tell, this has no performance impact on from_utf8_lossy,
but it does make it use no `unsafe` code.
auto merge of #12314 : huonw/rust/is_utf8_iter, r=kballard

See the commit messages for more details, but this makes `std::str::is_utf8` slightly faster and 100% non-`unsafe` and uses a similar thing to make the first scan of `from_utf8_lossy` 100% safe & faster.