blob: 6fb3fa3f83d6672fa5cc8f84b418b2a0a484b42f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
### What it does
This lint checks for invalid usages of `ptr::null`.
### Why is this bad?
This causes undefined behavior.
### Example
```
// Undefined behavior
unsafe { std::slice::from_raw_parts(ptr::null(), 0); }
```
Use instead:
```
unsafe { std::slice::from_raw_parts(NonNull::dangling().as_ptr(), 0); }
```
|