summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/transmuting_null.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/src/docs/transmuting_null.txt')
-rw-r--r--src/tools/clippy/src/docs/transmuting_null.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/transmuting_null.txt b/src/tools/clippy/src/docs/transmuting_null.txt
new file mode 100644
index 000000000..f8bacfc0b
--- /dev/null
+++ b/src/tools/clippy/src/docs/transmuting_null.txt
@@ -0,0 +1,15 @@
+### What it does
+Checks for transmute calls which would receive a null pointer.
+
+### Why is this bad?
+Transmuting a null pointer is undefined behavior.
+
+### Known problems
+Not all cases can be detected at the moment of this writing.
+For example, variables which hold a null pointer and are then fed to a `transmute`
+call, aren't detectable yet.
+
+### Example
+```
+let null_ref: &u64 = unsafe { std::mem::transmute(0 as *const u64) };
+``` \ No newline at end of file