summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/invalid_utf8_in_unchecked.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/src/docs/invalid_utf8_in_unchecked.txt')
-rw-r--r--src/tools/clippy/src/docs/invalid_utf8_in_unchecked.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/invalid_utf8_in_unchecked.txt b/src/tools/clippy/src/docs/invalid_utf8_in_unchecked.txt
new file mode 100644
index 000000000..afb5acbe9
--- /dev/null
+++ b/src/tools/clippy/src/docs/invalid_utf8_in_unchecked.txt
@@ -0,0 +1,12 @@
+### What it does
+Checks for `std::str::from_utf8_unchecked` with an invalid UTF-8 literal
+
+### Why is this bad?
+Creating such a `str` would result in undefined behavior
+
+### Example
+```
+unsafe {
+ std::str::from_utf8_unchecked(b"cl\x82ippy");
+}
+``` \ No newline at end of file