can_dereference

Function can_dereference 

Source
pub fn can_dereference<T: MetaSized>(ptr: *const T) -> bool
Expand description

Checks that pointer ptr point to a valid value of type T.

For that, the pointer has to be a valid pointer according to crate::mem conditions 1, 2 and 3, and the value stored must respect the validity invariants for type T.

This function will panic today if the pointer is not null, and it points to an unallocated or deallocated memory location. This is an existing Kani limitation. See https://github.com/model-checking/kani/issues/2690 for more details.