about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm_util.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-07-11 09:34:48 +0000
committerbors <bors@rust-lang.org>2023-07-11 09:34:48 +0000
commita8939e5eae4d6531f04599d24d9571fe8eec728f (patch)
treec06909b3822e397c297e01a339de427f13beb705 /compiler/rustc_codegen_llvm/src/llvm_util.rs
parentb485e4f840360feb66c2093db6246dc5f1cc311b (diff)
parent103949b241f66085d41f99d5f8ddbc281844df6d (diff)
downloadrust-a8939e5eae4d6531f04599d24d9571fe8eec728f.tar.gz
rust-a8939e5eae4d6531f04599d24d9571fe8eec728f.zip
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
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
0 files changed, 0 insertions, 0 deletions