You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix miri UB: use transmute_copy for function pointer identity checks (RustPython#8432)
Nightly miri now flags `fn_ptr as usize` and direct `fn_ptr == fn_ptr`
as UB because both paths go through `FnPtr::addr()`, which attempts to
dereference a function pointer's provenance — function items have no
backing allocation in miri's model.
Add `fn_addr<T>(f: T) -> usize` that uses `transmute_copy` to read
the address as plain integer bytes without triggering provenance
checks. Replace all `f as usize` slot comparison patterns across
the codebase with `fn_addr(f)`.
Also add `-Zmiri-permissive-provenance` to CI MIRIFLAGS as a safety
net for any remaining integer-pointer round-trips elsewhere.
Assisted-by: Claude
0 commit comments