]> git.lizzy.rs Git - rust.git/blob - src/docs/invalid_utf8_in_unchecked.txt
Auto merge of #9421 - xphoniex:fix-#9420, r=giraffate
[rust.git] / src / docs / invalid_utf8_in_unchecked.txt
1 ### What it does
2 Checks for `std::str::from_utf8_unchecked` with an invalid UTF-8 literal
3
4 ### Why is this bad?
5 Creating such a `str` would result in undefined behavior
6
7 ### Example
8 ```
9 unsafe {
10     std::str::from_utf8_unchecked(b"cl\x82ippy");
11 }
12 ```