Rollup merge of #113657 - Urgau:expand-incorrect_fn_null_check-lint, r=cjgillot
Expand, rename and improve `incorrect_fn_null_checks` lint This PR, - firstly, expand the lint by now linting on references - secondly, it renames the lint `incorrect_fn_null_checks` -> `useless_ptr_null_checks` - and thirdly it improves the lint by catching `ptr::from_mut`, `ptr::from_ref`, as well as `<*mut _>::cast` and `<*const _>::cast_mut` Fixes https://github.com/rust-lang/rust/issues/113601 cc ```@est31```
This commit is contained in:
@@ -613,11 +613,23 @@ pub struct ExpectationNote {
|
||||
pub rationale: Symbol,
|
||||
}
|
||||
|
||||
// fn_null_check.rs
|
||||
// ptr_nulls.rs
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(lint_fn_null_check)]
|
||||
#[help]
|
||||
pub struct FnNullCheckDiag;
|
||||
pub enum PtrNullChecksDiag<'a> {
|
||||
#[diag(lint_ptr_null_checks_fn_ptr)]
|
||||
#[help(lint_help)]
|
||||
FnPtr {
|
||||
orig_ty: Ty<'a>,
|
||||
#[label]
|
||||
label: Span,
|
||||
},
|
||||
#[diag(lint_ptr_null_checks_ref)]
|
||||
Ref {
|
||||
orig_ty: Ty<'a>,
|
||||
#[label]
|
||||
label: Span,
|
||||
},
|
||||
}
|
||||
|
||||
// for_loops_over_fallibles.rs
|
||||
#[derive(LintDiagnostic)]
|
||||
|
||||
Reference in New Issue
Block a user