Module rustc_lint::ptr_nulls

source ·



  • The useless_ptr_null_checks lint checks for useless null checks against pointers obtained from non-null types.


  • 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.