@@ -2,7 +2,9 @@ warning: function pointers are not nullable, so checking them for null will alwa
22  --> $DIR/ptr_null_checks.rs:14:8
33   |
44LL |     if (fn_ptr as *mut ()).is_null() {}
5-    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5+    |        ^------^^^^^^^^^^^^^^^^^^^^^^
6+    |         |
7+    |         expression has type `fn() {main}`
68   |
79   = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
810   = note: `#[warn(useless_ptr_null_checks)]` on by default
@@ -11,79 +13,99 @@ warning: function pointers are not nullable, so checking them for null will alwa
1113  --> $DIR/ptr_null_checks.rs:16:8
1214   |
1315LL |     if (fn_ptr as *const u8).is_null() {}
14-    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16+    |        ^------^^^^^^^^^^^^^^^^^^^^^^^^
17+    |         |
18+    |         expression has type `fn() {main}`
1519   |
1620   = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
1721
1822warning: function pointers are not nullable, so checking them for null will always return false
1923  --> $DIR/ptr_null_checks.rs:18:8
2024   |
2125LL |     if (fn_ptr as *const ()) == std::ptr::null() {}
22-    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26+    |        ^------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27+    |         |
28+    |         expression has type `fn() {main}`
2329   |
2430   = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
2531
2632warning: function pointers are not nullable, so checking them for null will always return false
2733  --> $DIR/ptr_null_checks.rs:20:8
2834   |
2935LL |     if (fn_ptr as *mut ()) == std::ptr::null_mut() {}
30-    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36+    |        ^------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
37+    |         |
38+    |         expression has type `fn() {main}`
3139   |
3240   = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
3341
3442warning: function pointers are not nullable, so checking them for null will always return false
3543  --> $DIR/ptr_null_checks.rs:22:8
3644   |
3745LL |     if (fn_ptr as *const ()) == (0 as *const ()) {}
38-    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
46+    |        ^------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47+    |         |
48+    |         expression has type `fn() {main}`
3949   |
4050   = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
4151
4252warning: function pointers are not nullable, so checking them for null will always return false
4353  --> $DIR/ptr_null_checks.rs:24:8
4454   |
4555LL |     if <*const _>::is_null(fn_ptr as *const ()) {}
46-    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56+    |        ^^^^^^^^^^^^^^^^^^^^------^^^^^^^^^^^^^^
57+    |                            |
58+    |                            expression has type `fn() {main}`
4759   |
4860   = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
4961
5062warning: function pointers are not nullable, so checking them for null will always return false
5163  --> $DIR/ptr_null_checks.rs:26:8
5264   |
5365LL |     if (fn_ptr as *mut fn() as *const fn() as *const ()).is_null() {}
54-    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66+    |        ^------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
67+    |         |
68+    |         expression has type `fn() {main}`
5569   |
5670   = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
5771
5872warning: function pointers are not nullable, so checking them for null will always return false
5973  --> $DIR/ptr_null_checks.rs:28:8
6074   |
6175LL |     if (fn_ptr as *mut fn() as *const fn()).cast_mut().is_null() {}
62-    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
76+    |        ^------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
77+    |         |
78+    |         expression has type `fn() {main}`
6379   |
6480   = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
6581
6682warning: function pointers are not nullable, so checking them for null will always return false
6783  --> $DIR/ptr_null_checks.rs:30:8
6884   |
6985LL |     if ((fn_ptr as *mut fn()).cast() as *const fn()).cast_mut().is_null() {}
70-    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
86+    |        ^^------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
87+    |          |
88+    |          expression has type `fn() {main}`
7189   |
7290   = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
7391
7492warning: function pointers are not nullable, so checking them for null will always return false
7593  --> $DIR/ptr_null_checks.rs:32:8
7694   |
7795LL |     if (fn_ptr as fn() as *const ()).is_null() {}
78-    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
96+    |        ^--------------^^^^^^^^^^^^^^^^^^^^^^^^
97+    |         |
98+    |         expression has type `fn()`
7999   |
80100   = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
81101
82102warning: function pointers are not nullable, so checking them for null will always return false
83103  --> $DIR/ptr_null_checks.rs:34:8
84104   |
85105LL |     if (c_fn as *const fn()).is_null() {}
86-    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
106+    |        ^----^^^^^^^^^^^^^^^^^^^^^^^^^^
107+    |         |
108+    |         expression has type `extern "C" fn() {c_fn}`
87109   |
88110   = help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
89111
0 commit comments