summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/transmuting_null.txt
blob: f8bacfc0b90b45d5b36a692e4039e87dfb5837d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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) };
```