In non-debug mode Rust is already checking these pointers, so let's only generate the relevant code in debug mode.