1
1
warning: function pointers are not nullable, so checking them for null will always return false
2
- --> $DIR/fn_null_check.rs:6 :8
2
+ --> $DIR/fn_null_check.rs:7 :8
3
3
|
4
4
LL | if (fn_ptr as *mut ()).is_null() {}
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -8,60 +8,124 @@ LL | if (fn_ptr as *mut ()).is_null() {}
8
8
= note: `#[warn(incorrect_fn_null_checks)]` on by default
9
9
10
10
warning: function pointers are not nullable, so checking them for null will always return false
11
- --> $DIR/fn_null_check.rs:8 :8
11
+ --> $DIR/fn_null_check.rs:9 :8
12
12
|
13
13
LL | if (fn_ptr as *const u8).is_null() {}
14
14
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15
15
|
16
16
= help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
17
17
18
18
warning: function pointers are not nullable, so checking them for null will always return false
19
- --> $DIR/fn_null_check.rs:10 :8
19
+ --> $DIR/fn_null_check.rs:11 :8
20
20
|
21
21
LL | if (fn_ptr as *const ()) == std::ptr::null() {}
22
22
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23
23
|
24
24
= help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
25
25
26
26
warning: function pointers are not nullable, so checking them for null will always return false
27
- --> $DIR/fn_null_check.rs:12 :8
27
+ --> $DIR/fn_null_check.rs:13 :8
28
28
|
29
29
LL | if (fn_ptr as *mut ()) == std::ptr::null_mut() {}
30
30
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
31
31
|
32
32
= help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
33
33
34
34
warning: function pointers are not nullable, so checking them for null will always return false
35
- --> $DIR/fn_null_check.rs:14 :8
35
+ --> $DIR/fn_null_check.rs:15 :8
36
36
|
37
37
LL | if (fn_ptr as *const ()) == (0 as *const ()) {}
38
38
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39
39
|
40
40
= help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
41
41
42
42
warning: function pointers are not nullable, so checking them for null will always return false
43
- --> $DIR/fn_null_check.rs:16 :8
43
+ --> $DIR/fn_null_check.rs:17 :8
44
44
|
45
45
LL | if <*const _>::is_null(fn_ptr as *const ()) {}
46
46
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47
47
|
48
48
= help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
49
49
50
50
warning: function pointers are not nullable, so checking them for null will always return false
51
- --> $DIR/fn_null_check.rs:18 :8
51
+ --> $DIR/fn_null_check.rs:19 :8
52
52
|
53
53
LL | if (fn_ptr as *mut fn() as *const fn() as *const ()).is_null() {}
54
54
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
55
55
|
56
56
= help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
57
57
58
58
warning: function pointers are not nullable, so checking them for null will always return false
59
- --> $DIR/fn_null_check.rs:20 :8
59
+ --> $DIR/fn_null_check.rs:21 :8
60
60
|
61
61
LL | if (fn_ptr as fn() as *const ()).is_null() {}
62
62
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
63
63
|
64
64
= help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
65
65
66
- warning: 8 warnings emitted
66
+ warning: references are not nullable, so checking them for null will always return false
67
+ --> $DIR/fn_null_check.rs:25:8
68
+ |
69
+ LL | if (&mut 8 as *mut i32).is_null() {}
70
+ | ^------^^^^^^^^^^^^^^^^^^^^^^^
71
+ | |
72
+ | expression has type `&mut i32`
73
+
74
+ warning: references are not nullable, so checking them for null will always return false
75
+ --> $DIR/fn_null_check.rs:27:8
76
+ |
77
+ LL | if (&8 as *const i32).is_null() {}
78
+ | ^--^^^^^^^^^^^^^^^^^^^^^^^^^
79
+ | |
80
+ | expression has type `&i32`
81
+
82
+ warning: references are not nullable, so checking them for null will always return false
83
+ --> $DIR/fn_null_check.rs:29:8
84
+ |
85
+ LL | if (&8 as *const i32) == std::ptr::null() {}
86
+ | ^--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
87
+ | |
88
+ | expression has type `&i32`
89
+
90
+ warning: references are not nullable, so checking them for null will always return false
91
+ --> $DIR/fn_null_check.rs:32:8
92
+ |
93
+ LL | if (ref_num as *const i32) == std::ptr::null() {}
94
+ | ^-------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
95
+ | |
96
+ | expression has type `&i32`
97
+
98
+ warning: references are not nullable, so checking them for null will always return false
99
+ --> $DIR/fn_null_check.rs:34:8
100
+ |
101
+ LL | if (b"\0" as *const u8).is_null() {}
102
+ | ^-----^^^^^^^^^^^^^^^^^^^^^^^^
103
+ | |
104
+ | expression has type `&[u8; 1]`
105
+
106
+ warning: references are not nullable, so checking them for null will always return false
107
+ --> $DIR/fn_null_check.rs:36:8
108
+ |
109
+ LL | if ("aa" as *const str).is_null() {}
110
+ | ^----^^^^^^^^^^^^^^^^^^^^^^^^^
111
+ | |
112
+ | expression has type `&str`
113
+
114
+ warning: references are not nullable, so checking them for null will always return false
115
+ --> $DIR/fn_null_check.rs:38:8
116
+ |
117
+ LL | if (&[1, 2] as *const i32).is_null() {}
118
+ | ^-------^^^^^^^^^^^^^^^^^^^^^^^^^
119
+ | |
120
+ | expression has type `&[i32; 2]`
121
+
122
+ warning: references are not nullable, so checking them for null will always return false
123
+ --> $DIR/fn_null_check.rs:40:8
124
+ |
125
+ LL | if (&mut [1, 2] as *mut i32) == std::ptr::null_mut() {}
126
+ | ^-----------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
127
+ | |
128
+ | expression has type `&mut [i32; 2]`
129
+
130
+ warning: 16 warnings emitted
67
131
0 commit comments