In one of my projects this line is the only place where Miri complains (warning by default, hard error with -Zmiri-strict-provenance).
The cast itself looks pretty suspicious to me and the quoted text is no longer present in the linked man page. Ideally, it would be nice to eliminate it completely, but as a quick and dirty workaround checking for zero and returning ptr::null() gated behind #[cfg(miri)] would work in most cases as well.
In one of my projects this line is the only place where Miri complains (warning by default, hard error with
-Zmiri-strict-provenance).The cast itself looks pretty suspicious to me and the quoted text is no longer present in the linked man page. Ideally, it would be nice to eliminate it completely, but as a quick and dirty workaround checking for zero and returning
ptr::null()gated behind#[cfg(miri)]would work in most cases as well.