Skip to main content

normalise_dump

Function normalise_dump 

Source
pub fn normalise_dump(s: &str) -> String
Expand description

Remove the parts of a dump that legitimately differ between two runs.

Object addresses, the dyld-relative context a private type prints itself in, and dump’s own back-reference numbering for repeated objects.

A third is Combine’s pointerValue, which is an address like any other — printed in decimal, so the rule for 0x… does not reach it.

A fourth is Predicate, whose variables are numbered from a counter that runs for the life of the process. The reference binary makes other predicates before it reaches this one, so the same predicate is Variable(0) here and Variable(9) there — and Variable(11) in the next case along, which is what gives it away.

A fourth is .task, whose modifier stores a name SwiftUI synthesizes from the call site’s #file and #line — "View.task @ <file>:<line>". Rust has no equivalent of either, and the two sides are genuinely at different source locations, so what follows the @ goes. The prefix stays, so a name of the wrong shape still fails.

A fourth is CharacterSet, which is a struct wrapping a bridged NSCharacterSet. Which concrete class backs it — a bitmap NSCharacterSet whose description lists every member, or a CF-bridged __NSCFCharacterSet that reflects as a superclass chain — depends on what else in the process has touched Foundation, so the same set reflects two ways in two processes. The set itself is identical; only its backing is not, so the backing goes.

Two more come from AttributedString, which a search field’s prompt is made of: Guts.version counts every attributed string the process has built, and _RopeVersion._value is seeded from the process’s random hash seed. Both differ between two runs of the same program, let alone between this one and the Swift reference, and neither says anything about the value. Everything left is a property of the value.