rust/compiler/rustc_lint/src
bors 63ef74b6aa Auto merge of #111717 - Urgau:uplift_fn_null_check, r=oli-obk
Uplift `clippy::fn_null_check` lint

This PR aims at uplifting the `clippy::fn_null_check` lint into rustc.

## `incorrect_fn_null_checks`

(warn-by-default)

The `incorrect_fn_null_checks` lint checks for expression that checks if a function pointer is null.

### Example

```rust
let fn_ptr: fn() = /* somehow obtained nullable function pointer */

if (fn_ptr as *const ()).is_null() { /* ... */ }
```

### Explanation

Function pointers are assumed to be non-null, checking for their nullity is incorrect.

-----

Mostly followed the instructions for uplifting a clippy lint described here: https://github.com/rust-lang/rust/pull/99696#pullrequestreview-1134072751

`@rustbot` label: +I-lang-nominated
r? compiler
2023-07-11 09:34:48 +00:00
..
nonstandard_style
array_into_iter.rs
builtin.rs Move TyCtxt::mk_x to Ty::new_x where applicable 2023-07-05 20:27:07 +01:00
cast_ref_to_mut.rs
context.rs Move TyCtxt::mk_x to Ty::new_x where applicable 2023-07-05 20:27:07 +01:00
deref_into_dyn_supertrait.rs
drop_forget_useless.rs Fix dropping_copy_types lint from linting in match-arm with side-effects 2023-07-01 16:05:55 +02:00
early.rs
enum_intrinsics_non_enums.rs
errors.rs
expect.rs
fn_null_check.rs Uplift clippy::fn_null_check to rustc 2023-07-10 18:12:41 +02:00
for_loops_over_fallibles.rs
hidden_unicode_codepoints.rs
internal.rs
invalid_from_utf8.rs
late.rs Add an ensure_sufficient_stack to LateContextAndPass::visit_expr 2023-06-15 09:57:47 -07:00
let_underscore.rs
levels.rs
lib.rs Uplift clippy::fn_null_check to rustc 2023-07-10 18:12:41 +02:00
lints.rs Uplift clippy::fn_null_check to rustc 2023-07-10 18:12:41 +02:00
map_unit_fn.rs
methods.rs
multiple_supertrait_upcastable.rs Migrate predicates_of and caller_bounds to Clause 2023-06-26 23:12:03 +00:00
non_ascii_idents.rs
non_fmt_panic.rs
nonstandard_style.rs allow host param to be lowercase 2023-07-04 11:47:46 +00:00
noop_method_call.rs do not use stringly typed diagnostics 2023-06-13 13:53:56 +00:00
opaque_hidden_inferred_bound.rs Move TyCtxt::mk_x to Ty::new_x where applicable 2023-07-05 20:27:07 +01:00
pass_by_value.rs
passes.rs
redundant_semicolon.rs
tests.rs
traits.rs Migrate predicates_of and caller_bounds to Clause 2023-06-26 23:12:03 +00:00
types.rs Move TyCtxt::mk_x to Ty::new_x where applicable 2023-07-05 20:27:07 +01:00
unused.rs Migrate item_bounds to ty::Clause 2023-06-22 18:34:23 +00:00