# Function rustc_lint::ptr_nulls::incorrect_check

source ·

    fn incorrect_check<'a, 'tcx: 'a>(
        cx: &'a LateContext<'tcx>,
        e: &'a Expr<'a>
    ) -> Option<PtrNullChecksDiag<'tcx>>

Expand description

This function checks if the expression is from a series of consecutive casts, ie. `(my_fn as *const _ as *mut _).cast_mut()` and whether the original expression is either a fn ptr, a reference, or a function call whose definition is annotated with `#![rustc_never_returns_null_ptr]`. If this situation is present, the function returns the appropriate diagnostic.