]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/transmuting_null.txt
Rollup merge of #101389 - lukaslueg:rcgetmutdocs, r=m-ou-se
[rust.git] / src / tools / clippy / src / docs / transmuting_null.txt
1 ### What it does
2 Checks for transmute calls which would receive a null pointer.
3
4 ### Why is this bad?
5 Transmuting a null pointer is undefined behavior.
6
7 ### Known problems
8 Not all cases can be detected at the moment of this writing.
9 For example, variables which hold a null pointer and are then fed to a `transmute`
10 call, aren't detectable yet.
11
12 ### Example
13 ```
14 let null_ref: &u64 = unsafe { std::mem::transmute(0 as *const u64) };
15 ```